@itee/tasks 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/docs/-_utils.mjs.html +68 -18
- package/docs/cleans_clean.task.mjs.html +10 -11
- package/docs/global.html +17 -173
- package/docs/helps_help.task.mjs.html +23 -59
- package/docs/index.html +4 -4
- package/docs/lints_lint.task.mjs.html +15 -12
- package/docs/patches_patch.task.mjs.html +14 -12
- package/docs/quicksearch.html +1 -1
- package/docs/releases_release.task.mjs.html +5 -5
- package/docs/tests_benchmarks_compute-benchmarks.task.mjs.html +35 -38
- package/docs/tests_benchmarks_run-benchmarks-for-backend.task.mjs.html +20 -18
- package/docs/tests_benchmarks_run-benchmarks-for-frontend.task.mjs.html +21 -23
- package/docs/tests_bundlings_check-bundling-from-esm-files-direct.task.mjs.html +22 -34
- package/docs/tests_bundlings_check-bundling.task.mjs.html +5 -5
- package/docs/tests_run-tests.task.mjs.html +5 -5
- package/docs/tests_units_compute-unit-tests.task.mjs.html +40 -42
- package/docs/tests_units_run-unit-tests-for-backend.task.mjs.html +21 -19
- package/docs/tests_units_run-unit-tests-for-frontend.task.mjs.html +21 -23
- package/package.json +4 -4
- package/{sources → scripts}/refresh.mjs +10 -12
- package/sources/builds/build.conf.mjs +3 -0
- package/sources/builds/build.task.mjs +11 -13
- package/{configs → sources}/cleans/clean.conf.mjs +1 -1
- package/sources/cleans/clean.task.mjs +6 -7
- package/{configs → sources}/docs/doc.conf.mjs +8 -7
- package/sources/docs/doc.task.mjs +7 -8
- package/sources/helps/help.task.mjs +18 -54
- package/{configs → sources}/lints/lint.conf.mjs +50 -18
- package/sources/lints/lint.task.mjs +11 -8
- package/sources/patches/patch.task.mjs +9 -7
- package/sources/releases/release.task.mjs +1 -1
- package/sources/tasks.js +26 -0
- package/sources/tests/benchmarks/compute-benchmarks.conf.mjs +5 -0
- package/sources/tests/benchmarks/compute-benchmarks.task.mjs +31 -34
- package/sources/tests/benchmarks/run-benchmarks-for-backend.task.mjs +16 -14
- package/{configs → sources}/tests/benchmarks/run-benchmarks-for-frontend.conf.mjs +6 -6
- package/sources/tests/benchmarks/run-benchmarks-for-frontend.task.mjs +17 -19
- package/{configs → sources}/tests/benchmarks/run-benchmarks.conf.mjs +2 -2
- package/sources/tests/benchmarks/run-benchmarks.task.mjs +3 -3
- package/{configs → sources}/tests/bundlings/check-bundling-from-esm-build-import.conf.mjs +12 -10
- package/sources/tests/bundlings/check-bundling-from-esm-build-import.task.mjs +17 -17
- package/{configs → sources}/tests/bundlings/check-bundling-from-esm-files-direct.conf.mjs +20 -14
- package/sources/tests/bundlings/check-bundling-from-esm-files-direct.task.mjs +17 -29
- package/{configs → sources}/tests/bundlings/check-bundling-from-esm-files-import.conf.mjs +15 -13
- package/sources/tests/bundlings/check-bundling-from-esm-files-import.task.mjs +17 -29
- package/sources/tests/bundlings/check-bundling.task.mjs +1 -1
- package/sources/tests/run-tests.task.mjs +1 -1
- package/sources/tests/units/compute-unit-tests.conf.mjs +5 -0
- package/sources/tests/units/compute-unit-tests.task.mjs +36 -38
- package/sources/tests/units/run-unit-tests-for-backend.task.mjs +17 -15
- package/{configs → sources}/tests/units/run-unit-tests-for-frontend.conf.mjs +1 -1
- package/sources/tests/units/run-unit-tests-for-frontend.task.mjs +17 -19
- package/{configs → sources}/tests/units/run-unit-tests.conf.mjs +2 -2
- package/sources/tests/units/run-unit-tests.task.mjs +3 -3
- package/sources/utils/builds.mjs +238 -0
- package/sources/utils/colors.mjs +19 -0
- package/sources/utils/files.mjs +70 -0
- package/sources/utils/loggings.mjs +33 -0
- package/sources/utils/packages.mjs +172 -0
- package/sources/utils/tasks.mjs +170 -0
- package/sources/utils/texts.mjs +98 -0
- package/configs/builds/build.conf.mjs +0 -3
- package/configs/tests/benchmarks/compute-benchmarks.conf.mjs +0 -5
- package/configs/tests/units/compute-unit-tests.conf.mjs +0 -5
- package/sources/_utils.mjs +0 -642
- package/sources/index.mjs +0 -21
- /package/{configs → scripts}/refresh.conf.mjs +0 -0
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import childProcess from 'child_process'
|
|
3
|
-
import log from 'fancy-log'
|
|
4
|
-
import { glob } from 'glob'
|
|
1
|
+
import childProcess from 'node:child_process'
|
|
5
2
|
import {
|
|
6
3
|
basename,
|
|
7
4
|
dirname,
|
|
8
5
|
extname,
|
|
9
6
|
join,
|
|
10
|
-
normalize,
|
|
11
7
|
relative
|
|
12
|
-
}
|
|
8
|
+
} from 'node:path'
|
|
9
|
+
import {
|
|
10
|
+
red,
|
|
11
|
+
yellow
|
|
12
|
+
} from '../../utils/colors.mjs'
|
|
13
13
|
import {
|
|
14
14
|
createDirectoryIfNotExist,
|
|
15
15
|
createFile,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
getJavascriptSourceFiles,
|
|
17
|
+
} from '../../utils/files.mjs'
|
|
18
|
+
import {
|
|
19
|
+
log,
|
|
20
|
+
logLoadingTask
|
|
21
|
+
} from '../../utils/loggings.mjs'
|
|
22
|
+
import {
|
|
23
|
+
getUnscopedPackageName,
|
|
19
24
|
packageNodeModulesDirectory,
|
|
20
25
|
packageSourcesDirectory,
|
|
21
26
|
packageTestsBenchmarksDirectory,
|
|
22
27
|
packageTestsDirectory
|
|
23
|
-
}
|
|
28
|
+
} from '../../utils/packages.mjs'
|
|
29
|
+
import { getTaskConfigurationFor } from '../../utils/tasks.mjs'
|
|
30
|
+
import { toCamelCase } from '../../utils/texts.mjs'
|
|
24
31
|
|
|
25
32
|
logLoadingTask( import.meta.filename )
|
|
26
33
|
|
|
27
|
-
const {
|
|
28
|
-
red,
|
|
29
|
-
yellow,
|
|
30
|
-
} = colors
|
|
31
|
-
|
|
32
34
|
/**
|
|
33
35
|
* @description Will generate benchmarks files from source code against provided alternatives
|
|
34
36
|
*/
|
|
@@ -38,18 +40,7 @@ const computeBenchmarksTask = async ( done ) => {
|
|
|
38
40
|
|
|
39
41
|
// Get task configuration
|
|
40
42
|
const filePathsToIgnore = await getTaskConfigurationFor( import.meta.filename )
|
|
41
|
-
|
|
42
|
-
// Get source files to process
|
|
43
|
-
const pattern = join( packageSourcesDirectory, '**' )
|
|
44
|
-
const sourceFiles = glob.sync( pattern )
|
|
45
|
-
.map( filePath => normalize( filePath ) )
|
|
46
|
-
.filter( filePath => {
|
|
47
|
-
const fileName = basename( filePath )
|
|
48
|
-
const isJsFile = fileName.endsWith( '.js' )
|
|
49
|
-
const isNotPrivateFile = !fileName.startsWith( '_' )
|
|
50
|
-
const isNotIgnoredFile = !filePathsToIgnore.includes( fileName )
|
|
51
|
-
return isJsFile && isNotPrivateFile && isNotIgnoredFile
|
|
52
|
-
} )
|
|
43
|
+
const sourceFiles = getJavascriptSourceFiles( filePathsToIgnore )
|
|
53
44
|
|
|
54
45
|
const benchRootImports = []
|
|
55
46
|
for ( let sourceFile of sourceFiles ) {
|
|
@@ -57,19 +48,25 @@ const computeBenchmarksTask = async ( done ) => {
|
|
|
57
48
|
const specificFilePath = sourceFile.replace( packageSourcesDirectory, '' )
|
|
58
49
|
const specificDir = dirname( specificFilePath )
|
|
59
50
|
|
|
60
|
-
const fileName
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
51
|
+
const fileName = basename( sourceFile, extname( sourceFile ) )
|
|
52
|
+
const camelCaseFileName = toCamelCase( fileName )
|
|
53
|
+
const benchFileName = `${ camelCaseFileName }.bench.js`
|
|
54
|
+
const benchDirPath = join( packageTestsBenchmarksDirectory, specificDir )
|
|
55
|
+
const benchFilePath = join( benchDirPath, benchFileName )
|
|
64
56
|
|
|
65
|
-
const nsName = `${
|
|
57
|
+
const nsName = `${ camelCaseFileName }Namespace`
|
|
66
58
|
const importDirPath = relative( benchDirPath, packageSourcesDirectory )
|
|
67
59
|
const importFilePath = join( importDirPath, specificFilePath ).replace( /\\/g, '/' )
|
|
68
60
|
|
|
69
61
|
try {
|
|
70
62
|
|
|
71
63
|
const jsdocPath = join( packageNodeModulesDirectory, '/jsdoc/jsdoc.js' )
|
|
72
|
-
const jsdocOutput = childProcess.execFileSync( 'node', [ jsdocPath, '
|
|
64
|
+
const jsdocOutput = childProcess.execFileSync( 'node', [ jsdocPath, '--explain', sourceFile ] ).toString()
|
|
65
|
+
|
|
66
|
+
if ( jsdocOutput.includes( 'There are no input files to process' ) ) {
|
|
67
|
+
log( 'Error ', red( `${ sourceFile }, no input files to process` ) )
|
|
68
|
+
continue
|
|
69
|
+
}
|
|
73
70
|
|
|
74
71
|
const classNames = []
|
|
75
72
|
const usedLongnames = []
|
|
@@ -223,7 +220,7 @@ const computeBenchmarksTask = async ( done ) => {
|
|
|
223
220
|
`\tsuite.run()` + '\n' +
|
|
224
221
|
`}` + '\n'
|
|
225
222
|
|
|
226
|
-
const benchesFilePath = join( packageTestsBenchmarksDirectory, `${
|
|
223
|
+
const benchesFilePath = join( packageTestsBenchmarksDirectory, `${ getUnscopedPackageName() }.benchmarks.js` )
|
|
227
224
|
createFile( benchesFilePath, benchesTemplate )
|
|
228
225
|
|
|
229
226
|
done()
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import log from 'fancy-log'
|
|
3
|
-
import { existsSync } from 'fs'
|
|
4
|
-
import { basename } from 'node:path'
|
|
5
|
-
import { join } from 'path'
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
6
2
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
basename,
|
|
4
|
+
join
|
|
5
|
+
} from 'node:path'
|
|
6
|
+
import {
|
|
7
|
+
red,
|
|
8
|
+
yellow
|
|
9
|
+
} from '../../utils/colors.mjs'
|
|
10
|
+
import {
|
|
11
|
+
log,
|
|
12
|
+
logLoadingTask
|
|
13
|
+
} from '../../utils/loggings.mjs'
|
|
14
|
+
import {
|
|
15
|
+
getUnscopedPackageName,
|
|
9
16
|
packageTestsBenchmarksDirectory
|
|
10
|
-
} from '../../
|
|
17
|
+
} from '../../utils/packages.mjs'
|
|
11
18
|
|
|
12
19
|
logLoadingTask( import.meta.filename )
|
|
13
20
|
|
|
14
|
-
const {
|
|
15
|
-
red,
|
|
16
|
-
yellow
|
|
17
|
-
} = colors
|
|
18
|
-
|
|
19
21
|
/**
|
|
20
22
|
* @description Will run benchmarks with node
|
|
21
23
|
*/
|
|
22
24
|
const runBenchmarksForBackendTask = async ( done ) => {
|
|
23
25
|
|
|
24
|
-
const benchesPath = join( packageTestsBenchmarksDirectory, `/${
|
|
26
|
+
const benchesPath = join( packageTestsBenchmarksDirectory, `/${ getUnscopedPackageName() }.benchmarks.js` )
|
|
25
27
|
if ( !existsSync( benchesPath ) ) {
|
|
26
28
|
log( yellow( `${ benchesPath } does not exist, skip backend benchmarks...` ) )
|
|
27
29
|
done()
|
|
@@ -2,17 +2,17 @@ import { jsonReporter } from '@itee/json-reporter'
|
|
|
2
2
|
import { playwrightLauncher } from '@web/test-runner-playwright'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
files:
|
|
5
|
+
files: [
|
|
6
6
|
'tests/benchmarks/**/*.bench.js'
|
|
7
7
|
],
|
|
8
|
-
debug:
|
|
9
|
-
nodeResolve:
|
|
10
|
-
browsers:
|
|
8
|
+
debug: false,
|
|
9
|
+
nodeResolve: true,
|
|
10
|
+
browsers: [
|
|
11
11
|
playwrightLauncher( { product: 'chromium' } ),
|
|
12
12
|
playwrightLauncher( { product: 'webkit' } ),
|
|
13
13
|
playwrightLauncher( { product: 'firefox' } ),
|
|
14
14
|
],
|
|
15
|
-
testFramework:
|
|
15
|
+
testFramework: {
|
|
16
16
|
path: 'node_modules/@itee/benchmarks-framework/benchmarks-framework.js',
|
|
17
17
|
config: {
|
|
18
18
|
foo: 'bar'
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
</body>
|
|
30
30
|
</html>
|
|
31
31
|
`,
|
|
32
|
-
reporters:
|
|
32
|
+
reporters: [
|
|
33
33
|
jsonReporter( {
|
|
34
34
|
reportProgress: true
|
|
35
35
|
} )
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import { startTestRunner }
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
logLoadingTask
|
|
7
|
-
} from '../../_utils.mjs'
|
|
1
|
+
import { startTestRunner } from '@web/test-runner'
|
|
2
|
+
import { basename } from 'node:path'
|
|
3
|
+
import { red } from '../../utils/colors.mjs'
|
|
4
|
+
import { logLoadingTask } from '../../utils/loggings.mjs'
|
|
5
|
+
import { getTaskConfigurationFor } from '../../utils/tasks.mjs'
|
|
8
6
|
|
|
9
7
|
logLoadingTask( import.meta.filename )
|
|
10
8
|
|
|
11
|
-
const { red } = colors
|
|
12
|
-
|
|
13
9
|
/**
|
|
14
10
|
* @description Will run benchmarks with web-test-runner
|
|
15
11
|
*/
|
|
16
|
-
const runBenchmarksForFrontendTask = () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
const runBenchmarksForFrontendTask = async () => {
|
|
13
|
+
|
|
14
|
+
const configuration = await getTaskConfigurationFor( import.meta.filename )
|
|
15
|
+
const testRunner = await startTestRunner( {
|
|
16
|
+
config: configuration,
|
|
17
|
+
readCliArgs: false,
|
|
18
|
+
readFileConfig: false,
|
|
19
|
+
autoExitProcess: false,
|
|
20
|
+
} )
|
|
21
|
+
|
|
22
|
+
return new Promise( ( resolve, reject ) => {
|
|
26
23
|
|
|
27
24
|
if ( !testRunner ) {
|
|
28
25
|
reject( red( 'Internal test runner error.' ) )
|
|
@@ -40,6 +37,7 @@ const runBenchmarksForFrontendTask = () => {
|
|
|
40
37
|
} )
|
|
41
38
|
|
|
42
39
|
} )
|
|
40
|
+
|
|
43
41
|
}
|
|
44
42
|
runBenchmarksForFrontendTask.displayName = basename( import.meta.filename, '.task.mjs' )
|
|
45
43
|
runBenchmarksForFrontendTask.description = 'Will run benchmarks with web-test-runner.'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { join } from 'path'
|
|
2
|
-
import { iteePackageSourcesDirectory } from '
|
|
1
|
+
import { join } from 'node:path'
|
|
2
|
+
import { iteePackageSourcesDirectory } from '../../utils/packages.mjs'
|
|
3
3
|
|
|
4
4
|
export default [
|
|
5
5
|
join( iteePackageSourcesDirectory, 'tests/benchmarks/run-benchmarks-for-backend.task.mjs' ),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { basename }
|
|
1
|
+
import { basename } from 'node:path'
|
|
2
|
+
import { logLoadingTask } from '../../utils/loggings.mjs'
|
|
2
3
|
import {
|
|
3
4
|
getTaskConfigurationFor,
|
|
4
|
-
logLoadingTask,
|
|
5
5
|
serializeTasksFrom
|
|
6
|
-
}
|
|
6
|
+
} from '../../utils/tasks.mjs'
|
|
7
7
|
|
|
8
8
|
logLoadingTask( import.meta.filename )
|
|
9
9
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
2
2
|
import cleanup from 'rollup-plugin-cleanup'
|
|
3
|
+
import { red } from '../../utils/colors.mjs'
|
|
4
|
+
import { log } from '../../utils/loggings.mjs'
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
|
-
input:
|
|
6
|
-
external:
|
|
7
|
-
plugins:
|
|
7
|
+
input: null,
|
|
8
|
+
external: [ '' ],
|
|
9
|
+
plugins: [
|
|
8
10
|
nodeResolve( {
|
|
9
11
|
preferBuiltins: true
|
|
10
12
|
} ),
|
|
@@ -12,7 +14,7 @@ export default {
|
|
|
12
14
|
comments: 'all' // else remove __PURE__ declaration... -_-'
|
|
13
15
|
} )
|
|
14
16
|
],
|
|
15
|
-
onwarn:
|
|
17
|
+
onwarn: ( {
|
|
16
18
|
loc,
|
|
17
19
|
frame,
|
|
18
20
|
message
|
|
@@ -22,11 +24,11 @@ export default {
|
|
|
22
24
|
if ( message.includes( 'Circular dependency' ) ) { return }
|
|
23
25
|
if ( message.includes( 'Generated an empty chunk' ) ) { return }
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
let errorMessage = ( loc )
|
|
28
|
+
? `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n`
|
|
29
|
+
: `/!\\ ${ message }\n`
|
|
30
|
+
|
|
31
|
+
log( red( errorMessage ) )
|
|
30
32
|
|
|
31
33
|
},
|
|
32
34
|
treeshake: {
|
|
@@ -37,7 +39,7 @@ export default {
|
|
|
37
39
|
tryCatchDeoptimization: true,
|
|
38
40
|
unknownGlobalSideEffects: true
|
|
39
41
|
},
|
|
40
|
-
output:
|
|
42
|
+
output: {
|
|
41
43
|
indent: '\t',
|
|
42
44
|
format: 'esm',
|
|
43
45
|
file: null
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import colors from 'ansi-colors'
|
|
2
|
-
import log from 'fancy-log'
|
|
3
1
|
import {
|
|
4
2
|
existsSync,
|
|
5
3
|
mkdirSync,
|
|
6
4
|
readFileSync,
|
|
7
5
|
rmSync,
|
|
8
6
|
writeFileSync
|
|
9
|
-
}
|
|
7
|
+
} from 'node:fs'
|
|
10
8
|
import {
|
|
11
9
|
basename,
|
|
12
10
|
join,
|
|
13
11
|
relative
|
|
14
|
-
}
|
|
15
|
-
import { rollup }
|
|
12
|
+
} from 'node:path'
|
|
13
|
+
import { rollup } from 'rollup'
|
|
16
14
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
green,
|
|
16
|
+
magenta,
|
|
17
|
+
red
|
|
18
|
+
} from '../../utils/colors.mjs'
|
|
19
|
+
import {
|
|
20
|
+
log,
|
|
21
|
+
logLoadingTask
|
|
22
|
+
} from '../../utils/loggings.mjs'
|
|
23
|
+
import {
|
|
24
|
+
getUnscopedPackageName,
|
|
19
25
|
packageBuildsDirectory,
|
|
20
|
-
packageName,
|
|
21
26
|
packageTestsBundlesDirectory
|
|
22
|
-
}
|
|
27
|
+
} from '../../utils/packages.mjs'
|
|
28
|
+
import { getTaskConfigurationFor } from '../../utils/tasks.mjs'
|
|
23
29
|
|
|
24
30
|
logLoadingTask( import.meta.filename )
|
|
25
31
|
|
|
26
|
-
const {
|
|
27
|
-
red,
|
|
28
|
-
green,
|
|
29
|
-
magenta,
|
|
30
|
-
} = colors
|
|
31
|
-
|
|
32
32
|
const checkBundlingFromEsmBuildImportTask = async ( done ) => {
|
|
33
33
|
|
|
34
34
|
const configuration = await getTaskConfigurationFor( import.meta.filename )
|
|
35
35
|
|
|
36
|
-
const buildFilePath = join( packageBuildsDirectory, `${
|
|
36
|
+
const buildFilePath = join( packageBuildsDirectory, `${ getUnscopedPackageName() }.esm.js` )
|
|
37
37
|
if ( !existsSync( buildFilePath ) ) {
|
|
38
38
|
done( red( buildFilePath + ' does not exist' ) )
|
|
39
39
|
}
|
|
@@ -41,7 +41,7 @@ const checkBundlingFromEsmBuildImportTask = async ( done ) => {
|
|
|
41
41
|
const outputDir = join( packageTestsBundlesDirectory, 'from_build_import' )
|
|
42
42
|
const temporaryDir = join( packageTestsBundlesDirectory, 'from_build_import', '.tmp' )
|
|
43
43
|
const importDir = relative( temporaryDir, packageBuildsDirectory )
|
|
44
|
-
const importFilePath = join( importDir, `${
|
|
44
|
+
const importFilePath = join( importDir, `${ getUnscopedPackageName() }.esm.js` )
|
|
45
45
|
|
|
46
46
|
if ( existsSync( outputDir ) ) {
|
|
47
47
|
log( 'Clean up', magenta( outputDir ) )
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import commonjs from '@rollup/plugin-commonjs'
|
|
2
|
+
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
3
|
+
import cleanup from 'rollup-plugin-cleanup'
|
|
4
|
+
import { red } from '../../utils/colors.mjs'
|
|
5
|
+
import { log } from '../../utils/loggings.mjs'
|
|
6
|
+
import { getUnscopedPackageName } from '../../utils/packages.mjs'
|
|
4
7
|
|
|
5
8
|
export default {
|
|
6
9
|
ignoredFiles: [
|
|
7
|
-
`${
|
|
10
|
+
`${ getUnscopedPackageName() }.js`
|
|
8
11
|
],
|
|
9
12
|
buildOptions: {
|
|
10
|
-
input:
|
|
11
|
-
external:
|
|
12
|
-
plugins:
|
|
13
|
+
input: null,
|
|
14
|
+
external: [ '' ],
|
|
15
|
+
plugins: [
|
|
16
|
+
commonjs( {
|
|
17
|
+
include: 'node_modules/**'
|
|
18
|
+
} ),
|
|
13
19
|
nodeResolve( {
|
|
14
20
|
preferBuiltins: true
|
|
15
21
|
} ),
|
|
@@ -17,7 +23,7 @@ export default {
|
|
|
17
23
|
comments: 'none'
|
|
18
24
|
} )
|
|
19
25
|
],
|
|
20
|
-
onwarn:
|
|
26
|
+
onwarn: ( {
|
|
21
27
|
loc,
|
|
22
28
|
frame,
|
|
23
29
|
message
|
|
@@ -27,11 +33,11 @@ export default {
|
|
|
27
33
|
if ( message.includes( 'Circular dependency' ) ) { return }
|
|
28
34
|
if ( message.includes( 'Generated an empty chunk' ) ) { return }
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
let errorMessage = ( loc )
|
|
37
|
+
? `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n`
|
|
38
|
+
: `/!\\ ${ message }\n`
|
|
39
|
+
|
|
40
|
+
log( red( errorMessage ) )
|
|
35
41
|
|
|
36
42
|
},
|
|
37
43
|
treeshake: {
|
|
@@ -42,7 +48,7 @@ export default {
|
|
|
42
48
|
tryCatchDeoptimization: true,
|
|
43
49
|
unknownGlobalSideEffects: true
|
|
44
50
|
},
|
|
45
|
-
output:
|
|
51
|
+
output: {
|
|
46
52
|
indent: '\t',
|
|
47
53
|
format: 'esm',
|
|
48
54
|
file: null
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import colors from 'ansi-colors'
|
|
2
|
-
import log from 'fancy-log'
|
|
3
1
|
import {
|
|
4
2
|
existsSync,
|
|
5
3
|
rmSync
|
|
6
|
-
}
|
|
7
|
-
import { glob } from 'glob'
|
|
4
|
+
} from 'node:fs'
|
|
8
5
|
import {
|
|
9
6
|
basename,
|
|
10
7
|
dirname,
|
|
11
8
|
extname,
|
|
12
|
-
join
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
import {
|
|
9
|
+
join
|
|
10
|
+
} from 'node:path'
|
|
11
|
+
import { rollup } from 'rollup'
|
|
12
|
+
import {
|
|
13
|
+
green,
|
|
14
|
+
magenta,
|
|
15
|
+
red,
|
|
16
|
+
} from '../../utils/colors.mjs'
|
|
17
|
+
import { getJavascriptSourceFiles } from '../../utils/files.mjs'
|
|
18
|
+
import {
|
|
19
|
+
log,
|
|
20
|
+
logLoadingTask
|
|
21
|
+
} from '../../utils/loggings.mjs'
|
|
16
22
|
import {
|
|
17
|
-
getTaskConfigurationFor,
|
|
18
|
-
logLoadingTask,
|
|
19
23
|
packageSourcesDirectory,
|
|
20
24
|
packageTestsBundlesDirectory
|
|
21
|
-
}
|
|
25
|
+
} from '../../utils/packages.mjs'
|
|
26
|
+
import { getTaskConfigurationFor } from '../../utils/tasks.mjs'
|
|
22
27
|
|
|
23
28
|
logLoadingTask( import.meta.filename )
|
|
24
29
|
|
|
25
|
-
const {
|
|
26
|
-
red,
|
|
27
|
-
green,
|
|
28
|
-
magenta,
|
|
29
|
-
} = colors
|
|
30
|
-
|
|
31
30
|
/**
|
|
32
31
|
* @description In view to detect bundling side effects this task will
|
|
33
32
|
* create intermediary file for each individual export from this package
|
|
@@ -43,18 +42,7 @@ const checkBundlingFromEsmFilesDirectTask = async ( done ) => {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
const configuration = await getTaskConfigurationFor( import.meta.filename )
|
|
46
|
-
|
|
47
|
-
// Get source files to process
|
|
48
|
-
const pattern = join( packageSourcesDirectory, '**' )
|
|
49
|
-
const sourceFiles = glob.sync( pattern )
|
|
50
|
-
.map( filePath => normalize( filePath ) )
|
|
51
|
-
.filter( filePath => {
|
|
52
|
-
const fileName = basename( filePath )
|
|
53
|
-
const isJsFile = fileName.endsWith( '.js' )
|
|
54
|
-
const isNotPrivateFile = !fileName.startsWith( '_' )
|
|
55
|
-
const isNotIgnoredFile = !configuration.ignoredFiles.includes( fileName )
|
|
56
|
-
return isJsFile && isNotPrivateFile && isNotIgnoredFile
|
|
57
|
-
} )
|
|
45
|
+
const sourceFiles = getJavascriptSourceFiles( configuration )
|
|
58
46
|
|
|
59
47
|
for ( let sourceFile of sourceFiles ) {
|
|
60
48
|
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import nodeResolve
|
|
2
|
-
import cleanup
|
|
3
|
-
import {
|
|
1
|
+
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
2
|
+
import cleanup from 'rollup-plugin-cleanup'
|
|
3
|
+
import { red } from '../../utils/colors.mjs'
|
|
4
|
+
import { log } from '../../utils/loggings.mjs'
|
|
5
|
+
import { getUnscopedPackageName } from '../../utils/packages.mjs'
|
|
4
6
|
|
|
5
7
|
export default {
|
|
6
8
|
ignoredFiles: [
|
|
7
|
-
`${
|
|
9
|
+
`${ getUnscopedPackageName() }.js`
|
|
8
10
|
],
|
|
9
11
|
buildOptions: {
|
|
10
|
-
input:
|
|
11
|
-
plugins:
|
|
12
|
+
input: null,
|
|
13
|
+
plugins: [
|
|
12
14
|
nodeResolve(),
|
|
13
15
|
cleanup( {
|
|
14
16
|
comments: 'all' // else remove __PURE__ declaration... -_-'
|
|
15
17
|
} )
|
|
16
18
|
],
|
|
17
|
-
onwarn:
|
|
19
|
+
onwarn: ( {
|
|
18
20
|
loc,
|
|
19
21
|
frame,
|
|
20
22
|
message
|
|
@@ -24,11 +26,11 @@ export default {
|
|
|
24
26
|
if ( message.includes( 'Circular dependency' ) ) { return }
|
|
25
27
|
if ( message.includes( 'Generated an empty chunk' ) ) { return }
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
let errorMessage = ( loc )
|
|
30
|
+
? `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n`
|
|
31
|
+
: `/!\\ ${ message }\n`
|
|
32
|
+
|
|
33
|
+
log( red( errorMessage ) )
|
|
32
34
|
|
|
33
35
|
},
|
|
34
36
|
treeshake: {
|
|
@@ -39,7 +41,7 @@ export default {
|
|
|
39
41
|
tryCatchDeoptimization: true,
|
|
40
42
|
unknownGlobalSideEffects: true
|
|
41
43
|
},
|
|
42
|
-
output:
|
|
44
|
+
output: {
|
|
43
45
|
indent: '\t',
|
|
44
46
|
format: 'esm',
|
|
45
47
|
file: null
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import colors from 'ansi-colors'
|
|
2
|
-
import log from 'fancy-log'
|
|
3
1
|
import {
|
|
4
2
|
existsSync,
|
|
5
3
|
mkdirSync,
|
|
6
4
|
rmSync,
|
|
7
5
|
writeFileSync
|
|
8
|
-
}
|
|
9
|
-
import { glob } from 'glob'
|
|
6
|
+
} from 'node:fs'
|
|
10
7
|
import {
|
|
11
8
|
basename,
|
|
12
9
|
dirname,
|
|
13
10
|
join,
|
|
14
|
-
normalize,
|
|
15
11
|
parse,
|
|
16
12
|
relative
|
|
17
|
-
}
|
|
18
|
-
import { rollup }
|
|
13
|
+
} from 'node:path'
|
|
14
|
+
import { rollup } from 'rollup'
|
|
15
|
+
import {
|
|
16
|
+
green,
|
|
17
|
+
magenta,
|
|
18
|
+
red
|
|
19
|
+
} from '../../utils/colors.mjs'
|
|
20
|
+
import { getJavascriptSourceFiles } from '../../utils/files.mjs'
|
|
21
|
+
import {
|
|
22
|
+
log,
|
|
23
|
+
logLoadingTask
|
|
24
|
+
} from '../../utils/loggings.mjs'
|
|
19
25
|
import {
|
|
20
|
-
getTaskConfigurationFor,
|
|
21
|
-
logLoadingTask,
|
|
22
26
|
packageSourcesDirectory,
|
|
23
27
|
packageTestsBundlesDirectory
|
|
24
|
-
}
|
|
28
|
+
} from '../../utils/packages.mjs'
|
|
29
|
+
import { getTaskConfigurationFor } from '../../utils/tasks.mjs'
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
red,
|
|
28
|
-
green,
|
|
29
|
-
magenta,
|
|
30
|
-
} = colors
|
|
31
|
+
logLoadingTask( import.meta.filename )
|
|
31
32
|
|
|
32
33
|
const checkBundlingFromEsmFilesImportTask = async ( done ) => {
|
|
33
34
|
|
|
@@ -40,18 +41,7 @@ const checkBundlingFromEsmFilesImportTask = async ( done ) => {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const configuration = await getTaskConfigurationFor( import.meta.filename )
|
|
43
|
-
|
|
44
|
-
// Get source files to process
|
|
45
|
-
const pattern = join( packageSourcesDirectory, '**' )
|
|
46
|
-
const sourceFiles = glob.sync( pattern )
|
|
47
|
-
.map( filePath => normalize( filePath ) )
|
|
48
|
-
.filter( filePath => {
|
|
49
|
-
const fileName = basename( filePath )
|
|
50
|
-
const isJsFile = fileName.endsWith( '.js' )
|
|
51
|
-
const isNotPrivateFile = !fileName.startsWith( '_' )
|
|
52
|
-
const isNotIgnoredFile = !configuration.ignoredFiles.includes( fileName )
|
|
53
|
-
return isJsFile && isNotPrivateFile && isNotIgnoredFile
|
|
54
|
-
} )
|
|
44
|
+
const sourceFiles = getJavascriptSourceFiles( configuration )
|
|
55
45
|
|
|
56
46
|
for ( let sourceFile of sourceFiles ) {
|
|
57
47
|
|
|
@@ -108,6 +98,4 @@ checkBundlingFromEsmFilesImportTask.displayName = basename( import.meta.filename
|
|
|
108
98
|
checkBundlingFromEsmFilesImportTask.description = 'In view to detect bundling side effects this task will create intermediary file for each individual export from this package and then create rollup config for each of them and bundle'
|
|
109
99
|
checkBundlingFromEsmFilesImportTask.flags = null
|
|
110
100
|
|
|
111
|
-
logLoadingTask( import.meta.filename )
|
|
112
|
-
|
|
113
101
|
export { checkBundlingFromEsmFilesImportTask }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { series } from 'gulp'
|
|
2
2
|
import { basename } from 'node:path'
|
|
3
|
-
import { logLoadingTask } from '../../
|
|
3
|
+
import { logLoadingTask } from '../../utils/loggings.mjs'
|
|
4
4
|
import { checkBundlingFromEsmBuildImportTask } from './check-bundling-from-esm-build-import.task.mjs'
|
|
5
5
|
import { checkBundlingFromEsmFilesDirectTask } from './check-bundling-from-esm-files-direct.task.mjs'
|
|
6
6
|
import { checkBundlingFromEsmFilesImportTask } from './check-bundling-from-esm-files-import.task.mjs'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { series } from 'gulp'
|
|
2
2
|
import { basename } from 'node:path'
|
|
3
|
-
import { logLoadingTask } from '../
|
|
3
|
+
import { logLoadingTask } from '../utils/loggings.mjs'
|
|
4
4
|
import { runBenchmarksTestsTask } from './benchmarks/run-benchmarks.task.mjs'
|
|
5
5
|
import { runUnitTestsTask } from './units/run-unit-tests.task.mjs'
|
|
6
6
|
|