mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-10 13:42:27 +03:00
improve build, better defaults and improved body init
This commit is contained in:
@@ -8,6 +8,7 @@ export function each(source, callback) {
|
||||
}
|
||||
}
|
||||
else if (source) {
|
||||
// cant use support func keys here due to circular dep
|
||||
each(Object.keys(source), (key) => callback(source[key], key, source));
|
||||
}
|
||||
return source;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/support/utils/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAqChD,MAAM,UAAU,IAAI,CAClB,MAA2F,EAC3F,QAAuE;IAEvE,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,KAAK,EAAE;gBAC5C,MAAM;aACP;SACF;KACF;SAAM,IAAI,MAAM,EAAE;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;KACxE;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAU,GAAQ,EAAE,IAAO,EAAE,SAAkB,EAAU,EAAE,CAChF,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAE/B;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAI,KAAU,EAAE,KAAuB,EAAE,iBAA2B,EAAO,EAAE;IAC/F,CAAC,iB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,IAAI,CAAE,GAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC"}
|
||||
@@ -6,7 +6,7 @@ module.exports = {
|
||||
actionTimeout: 300,
|
||||
navigationTimeout: 1000,
|
||||
retries: 0,
|
||||
workers: 4,
|
||||
workers: 1,
|
||||
projects: [
|
||||
{
|
||||
name: 'Chromium',
|
||||
|
||||
@@ -31,24 +31,29 @@ const resolvePath = (basePath, pathToResolve, appendExt) => {
|
||||
return normalizePath(result && appendExt ? appendExtension(result) : result);
|
||||
};
|
||||
|
||||
const getWorkspaceAliases = () =>
|
||||
// if the import would be 'overlayscrollbars' and the package name is also 'overlayscrollbars' esbuild needs an alias to resolve it correctly
|
||||
// only needed for playwright with esbuild
|
||||
const getOverlappingPackageNameAliases = () =>
|
||||
pkg.workspaces
|
||||
.map((pattern) => glob.sync(pattern, { cwd: workspaceRoot }))
|
||||
.flat()
|
||||
.reduce((obj, resolvedPath) => {
|
||||
let projTsConfig;
|
||||
const absolutePath = path.resolve(workspaceRoot, resolvedPath);
|
||||
try {
|
||||
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||
projTsConfig = require(`${path.resolve(workspaceRoot, resolvedPath)}/tsconfig.json`);
|
||||
} catch {}
|
||||
const projTsConfig = require(`${path.resolve(workspaceRoot, resolvedPath)}/tsconfig.json`);
|
||||
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||
const projPackageJson = require(`${path.resolve(
|
||||
workspaceRoot,
|
||||
resolvedPath
|
||||
)}/package.json`);
|
||||
|
||||
obj[`@/${path.basename(absolutePath)}`] = `${normalizePath(
|
||||
path.resolve(
|
||||
absolutePath,
|
||||
projTsConfig?.compilerOptions?.baseUrl || defaultOptions.paths.src
|
||||
)
|
||||
)}`;
|
||||
const { name } = projPackageJson;
|
||||
const { compilerOptions } = projTsConfig;
|
||||
const { baseUrl } = compilerOptions;
|
||||
|
||||
obj[name] = resolvePath(absolutePath, path.join(baseUrl, name), true);
|
||||
} catch {}
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
@@ -91,7 +96,6 @@ const mergeAndResolveOptions = (userOptions) => {
|
||||
...rawPaths,
|
||||
},
|
||||
alias: {
|
||||
...getWorkspaceAliases(),
|
||||
...defaultAlias,
|
||||
...rawAlias,
|
||||
},
|
||||
@@ -133,13 +137,19 @@ const createConfig = (userOptions = {}) => {
|
||||
}
|
||||
|
||||
if (isBuild) {
|
||||
const js = pipelineBuild(resolve, options);
|
||||
const types = extractTypes && pipelineTypes(resolve, options);
|
||||
const styles = extractStyles && pipelineStyles(resolve, options);
|
||||
const types = extractTypes && pipelineTypes(resolve, options);
|
||||
const js = pipelineBuild(resolve, options);
|
||||
|
||||
return [styles, types, js].flat().filter((build) => !!build);
|
||||
}
|
||||
|
||||
// only needed for playwright!
|
||||
options.alias = {
|
||||
...getOverlappingPackageNameAliases(),
|
||||
...options.alias,
|
||||
};
|
||||
|
||||
return [pipelineDev(resolve, options)];
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ module.exports = {
|
||||
verbose: false,
|
||||
banner: null,
|
||||
paths: {
|
||||
src: './src',
|
||||
dist: './dist',
|
||||
types: './types',
|
||||
styles: './styles',
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = (resolve, options) => {
|
||||
const { rollup, paths, versions, alias, extractStyles, banner } = options;
|
||||
const { output: rollupOutput, input, plugins = [], ...rollupOptions } = rollup;
|
||||
const { name, file, globals, exports, sourcemap: rawSourcemap, ...outputConfig } = rollupOutput;
|
||||
const { src: srcPath, dist: distPath } = paths;
|
||||
const { dist: distPath } = paths;
|
||||
const sourcemap = rawSourcemap;
|
||||
|
||||
return versions
|
||||
@@ -70,8 +70,8 @@ module.exports = (resolve, options) => {
|
||||
rollupLicense(banner, sourcemap),
|
||||
rollupAlias(alias),
|
||||
rollupScss(banner, sourcemap, extractStyles, false),
|
||||
rollupTs(srcPath),
|
||||
rollupResolve(srcPath, resolve),
|
||||
rollupTs(input),
|
||||
rollupResolve(resolve),
|
||||
rollupCommonjs(sourcemap, resolve),
|
||||
rollupBabel(resolve, generatedCode === 'es2015'),
|
||||
...plugins,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
const sass = require('sass');
|
||||
const postcss = require('postcss');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
@@ -13,6 +14,9 @@ const rollupPluginLicense = require('rollup-plugin-license');
|
||||
const babelConfigEs5 = require('./babel.config.es5');
|
||||
const babelConfigEs6 = require('./babel.config.es2015');
|
||||
|
||||
const normalizePath = (pathName) =>
|
||||
pathName ? pathName.split(path.sep).join(path.posix.sep) : pathName;
|
||||
|
||||
module.exports = {
|
||||
rollupAlias: (aliasEntries) =>
|
||||
rollupPluginAlias({
|
||||
@@ -23,12 +27,12 @@ module.exports = {
|
||||
sourceMap: sourcemap,
|
||||
extensions: resolve.extensions,
|
||||
}),
|
||||
rollupResolve: (srcPath, resolve) =>
|
||||
rollupResolve: (resolve) =>
|
||||
rollupPluginResolve({
|
||||
mainFields: ['browser', 'umd:main', 'module', 'main'],
|
||||
rootDir: srcPath,
|
||||
moduleDirectories: resolve.directories,
|
||||
extensions: resolve.extensions,
|
||||
ignoreSideEffectsForRoot: true,
|
||||
}),
|
||||
rollupScss: (banner, sourceMap, extractStyleOption, output) => {
|
||||
if (extractStyleOption) {
|
||||
@@ -56,7 +60,6 @@ module.exports = {
|
||||
rollupEsBuild: () =>
|
||||
rollupPluginEsBuild({
|
||||
include: /\.[jt]sx?$/,
|
||||
sourceMap: true,
|
||||
target: 'es6',
|
||||
tsconfig: './tsconfig.json',
|
||||
}),
|
||||
@@ -89,7 +92,7 @@ module.exports = {
|
||||
},
|
||||
extensions: resolve.extensions,
|
||||
}),
|
||||
rollupTs: (srcPath, declaration) =>
|
||||
rollupTs: (input, declaration) =>
|
||||
rollupPluginTs({
|
||||
tsconfigOverride: {
|
||||
compilerOptions: {
|
||||
@@ -98,7 +101,7 @@ module.exports = {
|
||||
declarationMap: declaration,
|
||||
},
|
||||
// files to include / exclude from typescript .d.ts generation
|
||||
include: [`${srcPath}/**/*`],
|
||||
include: [`${normalizePath(path.dirname(path.resolve(input)))}/**/*`],
|
||||
exclude: ['node_modules', '**/node_modules/*', '*.d.ts', '**/*.d.ts'],
|
||||
},
|
||||
clean: true,
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = (resolve, options) => {
|
||||
const { rollup, paths, alias, extractStyles, banner } = options;
|
||||
const { output: rollupOutput, input, plugins = [], ...rollupOptions } = rollup;
|
||||
const { file, sourcemap: rawSourcemap, ...outputConfig } = rollupOutput;
|
||||
const { src: srcPath, dist: distPath } = paths;
|
||||
const { dist: distPath } = paths;
|
||||
const sourcemap = rawSourcemap;
|
||||
|
||||
const output = {
|
||||
@@ -30,8 +30,8 @@ module.exports = (resolve, options) => {
|
||||
rollupAlias(alias),
|
||||
rollupScss(banner, sourcemap, extractStyles, false),
|
||||
rollupEsBuild(),
|
||||
rollupResolve(srcPath, resolve),
|
||||
rollupCommonjs(sourcemap, resolve),
|
||||
rollupResolve(resolve),
|
||||
...plugins,
|
||||
].filter(Boolean),
|
||||
};
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
const path = require('path');
|
||||
const { rollupResolve, rollupScss, rollupEsBuild } = require('./pipeline.common.plugins');
|
||||
const {
|
||||
rollupAlias,
|
||||
rollupResolve,
|
||||
rollupCommonjs,
|
||||
rollupScss,
|
||||
rollupTs,
|
||||
} = require('./pipeline.common.plugins');
|
||||
|
||||
module.exports = (resolve, options) => {
|
||||
const { rollup, paths, banner } = options;
|
||||
const { rollup, alias, paths, banner } = options;
|
||||
const { output: rollupOutput, input } = rollup;
|
||||
const { file, sourcemap } = rollupOutput;
|
||||
const { src: srcPath, styles: stylesPath } = paths;
|
||||
const { styles: stylesPath } = paths;
|
||||
const ogWrite = process.stdout.write;
|
||||
|
||||
return {
|
||||
input,
|
||||
plugins: [
|
||||
rollupResolve(srcPath, resolve),
|
||||
rollupAlias(alias),
|
||||
rollupScss(banner, sourcemap, true, path.resolve(stylesPath, `${file}.css`)),
|
||||
rollupEsBuild(),
|
||||
rollupTs(input),
|
||||
rollupResolve(resolve),
|
||||
rollupCommonjs(sourcemap, resolve),
|
||||
{
|
||||
generateBundle() {
|
||||
process.stdout.write = () => {
|
||||
|
||||
@@ -8,7 +8,7 @@ module.exports = (resolve, options) => {
|
||||
const { rollup, paths } = options;
|
||||
const { output: rollupOutput, input } = rollup;
|
||||
const { file } = rollupOutput;
|
||||
const { src: srcPath, types: typesPath } = paths;
|
||||
const { types: typesPath } = paths;
|
||||
const dtsOutput = path.resolve(typesPath, `${file}.d.ts`);
|
||||
|
||||
return [
|
||||
@@ -22,7 +22,7 @@ module.exports = (resolve, options) => {
|
||||
output: {
|
||||
file: path.resolve(typesPath, `${file}`),
|
||||
},
|
||||
plugins: [rollupTs(srcPath, true)],
|
||||
plugins: [rollupTs(input, true)],
|
||||
},
|
||||
{
|
||||
input: path.join(typesPath, `${basename(input).replace('.ts', '.d.ts')}`),
|
||||
|
||||
@@ -33,7 +33,6 @@ module.exports = (testDir, mode = 'dev', onListening = null) => {
|
||||
banner: `${testDir}`,
|
||||
paths: {
|
||||
dist,
|
||||
src: path.resolve(testDir, './'),
|
||||
},
|
||||
versions: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user