@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.
Files changed (68) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/docs/-_utils.mjs.html +68 -18
  3. package/docs/cleans_clean.task.mjs.html +10 -11
  4. package/docs/global.html +17 -173
  5. package/docs/helps_help.task.mjs.html +23 -59
  6. package/docs/index.html +4 -4
  7. package/docs/lints_lint.task.mjs.html +15 -12
  8. package/docs/patches_patch.task.mjs.html +14 -12
  9. package/docs/quicksearch.html +1 -1
  10. package/docs/releases_release.task.mjs.html +5 -5
  11. package/docs/tests_benchmarks_compute-benchmarks.task.mjs.html +35 -38
  12. package/docs/tests_benchmarks_run-benchmarks-for-backend.task.mjs.html +20 -18
  13. package/docs/tests_benchmarks_run-benchmarks-for-frontend.task.mjs.html +21 -23
  14. package/docs/tests_bundlings_check-bundling-from-esm-files-direct.task.mjs.html +22 -34
  15. package/docs/tests_bundlings_check-bundling.task.mjs.html +5 -5
  16. package/docs/tests_run-tests.task.mjs.html +5 -5
  17. package/docs/tests_units_compute-unit-tests.task.mjs.html +40 -42
  18. package/docs/tests_units_run-unit-tests-for-backend.task.mjs.html +21 -19
  19. package/docs/tests_units_run-unit-tests-for-frontend.task.mjs.html +21 -23
  20. package/package.json +4 -4
  21. package/{sources → scripts}/refresh.mjs +10 -12
  22. package/sources/builds/build.conf.mjs +3 -0
  23. package/sources/builds/build.task.mjs +11 -13
  24. package/{configs → sources}/cleans/clean.conf.mjs +1 -1
  25. package/sources/cleans/clean.task.mjs +6 -7
  26. package/{configs → sources}/docs/doc.conf.mjs +8 -7
  27. package/sources/docs/doc.task.mjs +7 -8
  28. package/sources/helps/help.task.mjs +18 -54
  29. package/{configs → sources}/lints/lint.conf.mjs +50 -18
  30. package/sources/lints/lint.task.mjs +11 -8
  31. package/sources/patches/patch.task.mjs +9 -7
  32. package/sources/releases/release.task.mjs +1 -1
  33. package/sources/tasks.js +26 -0
  34. package/sources/tests/benchmarks/compute-benchmarks.conf.mjs +5 -0
  35. package/sources/tests/benchmarks/compute-benchmarks.task.mjs +31 -34
  36. package/sources/tests/benchmarks/run-benchmarks-for-backend.task.mjs +16 -14
  37. package/{configs → sources}/tests/benchmarks/run-benchmarks-for-frontend.conf.mjs +6 -6
  38. package/sources/tests/benchmarks/run-benchmarks-for-frontend.task.mjs +17 -19
  39. package/{configs → sources}/tests/benchmarks/run-benchmarks.conf.mjs +2 -2
  40. package/sources/tests/benchmarks/run-benchmarks.task.mjs +3 -3
  41. package/{configs → sources}/tests/bundlings/check-bundling-from-esm-build-import.conf.mjs +12 -10
  42. package/sources/tests/bundlings/check-bundling-from-esm-build-import.task.mjs +17 -17
  43. package/{configs → sources}/tests/bundlings/check-bundling-from-esm-files-direct.conf.mjs +20 -14
  44. package/sources/tests/bundlings/check-bundling-from-esm-files-direct.task.mjs +17 -29
  45. package/{configs → sources}/tests/bundlings/check-bundling-from-esm-files-import.conf.mjs +15 -13
  46. package/sources/tests/bundlings/check-bundling-from-esm-files-import.task.mjs +17 -29
  47. package/sources/tests/bundlings/check-bundling.task.mjs +1 -1
  48. package/sources/tests/run-tests.task.mjs +1 -1
  49. package/sources/tests/units/compute-unit-tests.conf.mjs +5 -0
  50. package/sources/tests/units/compute-unit-tests.task.mjs +36 -38
  51. package/sources/tests/units/run-unit-tests-for-backend.task.mjs +17 -15
  52. package/{configs → sources}/tests/units/run-unit-tests-for-frontend.conf.mjs +1 -1
  53. package/sources/tests/units/run-unit-tests-for-frontend.task.mjs +17 -19
  54. package/{configs → sources}/tests/units/run-unit-tests.conf.mjs +2 -2
  55. package/sources/tests/units/run-unit-tests.task.mjs +3 -3
  56. package/sources/utils/builds.mjs +238 -0
  57. package/sources/utils/colors.mjs +19 -0
  58. package/sources/utils/files.mjs +70 -0
  59. package/sources/utils/loggings.mjs +33 -0
  60. package/sources/utils/packages.mjs +172 -0
  61. package/sources/utils/tasks.mjs +170 -0
  62. package/sources/utils/texts.mjs +98 -0
  63. package/configs/builds/build.conf.mjs +0 -3
  64. package/configs/tests/benchmarks/compute-benchmarks.conf.mjs +0 -5
  65. package/configs/tests/units/compute-unit-tests.conf.mjs +0 -5
  66. package/sources/_utils.mjs +0 -642
  67. package/sources/index.mjs +0 -21
  68. /package/{configs → scripts}/refresh.conf.mjs +0 -0
@@ -1,34 +1,36 @@
1
- import colors from 'ansi-colors'
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
- } from 'path'
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
- getTaskConfigurationFor,
17
- logLoadingTask,
18
- packageName,
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
- } from '../../_utils.mjs'
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 = basename( sourceFile, extname( sourceFile ) )
61
- const benchFileName = `${ fileName }.bench.js`
62
- const benchDirPath = join( packageTestsBenchmarksDirectory, specificDir )
63
- const benchFilePath = join( benchDirPath, benchFileName )
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 = `${ fileName }Namespace`
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, '-X', sourceFile ] ).toString()
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, `${ packageName }.benchmarks.js` )
223
+ const benchesFilePath = join( packageTestsBenchmarksDirectory, `${ getUnscopedPackageName() }.benchmarks.js` )
227
224
  createFile( benchesFilePath, benchesTemplate )
228
225
 
229
226
  done()
@@ -1,27 +1,29 @@
1
- import colors from 'ansi-colors'
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
- logLoadingTask,
8
- packageName,
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 '../../_utils.mjs'
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, `/${ packageName }.benchmarks.js` )
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: false,
9
- nodeResolve: true,
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 } from '@web/test-runner'
2
- import colors from 'ansi-colors'
3
- import { basename } from 'node:path'
4
- import {
5
- getTaskConfigurationFor,
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
- return new Promise( async ( resolve, reject ) => {
18
-
19
- const configuration = await getTaskConfigurationFor( import.meta.filename )
20
- const testRunner = await startTestRunner( {
21
- config: configuration,
22
- readCliArgs: false,
23
- readFileConfig: false,
24
- autoExitProcess: false,
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 '../../../sources/_utils.mjs'
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 } from 'node:path'
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
- } from '../../_utils.mjs'
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: null,
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
- if ( loc ) {
26
- process.stderr.write( `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n` )
27
- } else {
28
- process.stderr.write( `/!\\ ${ message }\n` )
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
- } from 'fs'
7
+ } from 'node:fs'
10
8
  import {
11
9
  basename,
12
10
  join,
13
11
  relative
14
- } from 'path'
15
- import { rollup } from 'rollup'
12
+ } from 'node:path'
13
+ import { rollup } from 'rollup'
16
14
  import {
17
- getTaskConfigurationFor,
18
- logLoadingTask,
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
- } from '../../_utils.mjs'
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, `${ packageName }.esm.js` )
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, `${ packageName }.esm.js` )
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 nodeResolve from '@rollup/plugin-node-resolve'
2
- import cleanup from 'rollup-plugin-cleanup'
3
- import { packageName } from '../../../sources/index.mjs'
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
- `${ packageName }.js`
10
+ `${ getUnscopedPackageName() }.js`
8
11
  ],
9
12
  buildOptions: {
10
- input: null,
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
- if ( loc ) {
31
- process.stderr.write( `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n` )
32
- } else {
33
- process.stderr.write( `/!\\ ${ message }\n` )
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
- } from 'fs'
7
- import { glob } from 'glob'
4
+ } from 'node:fs'
8
5
  import {
9
6
  basename,
10
7
  dirname,
11
8
  extname,
12
- join,
13
- normalize
14
- } from 'path'
15
- import { rollup } from 'rollup'
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
- } from '../../_utils.mjs'
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 from '@rollup/plugin-node-resolve'
2
- import cleanup from 'rollup-plugin-cleanup'
3
- import { packageName } from '../../../sources/index.mjs'
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
- `${ packageName }.js`
9
+ `${ getUnscopedPackageName() }.js`
8
10
  ],
9
11
  buildOptions: {
10
- input: null,
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
- if ( loc ) {
28
- process.stderr.write( `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n` )
29
- } else {
30
- process.stderr.write( `/!\\ ${ message }\n` )
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
- } from 'fs'
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
- } from 'path'
18
- import { rollup } from '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
- } from '../../_utils.mjs'
28
+ } from '../../utils/packages.mjs'
29
+ import { getTaskConfigurationFor } from '../../utils/tasks.mjs'
25
30
 
26
- const {
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 '../../_utils.mjs'
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 '../_utils.mjs'
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