itee-validators 5.6.0 → 6.0.0

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 (131) hide show
  1. package/.github/workflows/node.js.yml +2 -2
  2. package/.releaserc.mjs +94 -0
  3. package/.tasks/.builds/build-benchmarks.task.mjs +16 -0
  4. package/.tasks/.builds/build-tests.task.mjs +18 -0
  5. package/.tasks/.builds/build-unit-tests.task.mjs +16 -0
  6. package/.tasks/.builds/build.task.mjs +46 -0
  7. package/.tasks/.cleans/clean.task.mjs +23 -0
  8. package/.tasks/.docs/doc.task.mjs +35 -0
  9. package/.tasks/.helps/help.task.mjs +151 -0
  10. package/.tasks/.lints/lint.task.mjs +37 -0
  11. package/.tasks/.patches/patch.task.mjs +13 -0
  12. package/.tasks/.releases/release.task.mjs +26 -0
  13. package/.tasks/.tests/benchmarks/build-benchmarks-backend.task.mjs +42 -0
  14. package/.tasks/{tests/benchmarks/compute-benchmarks.mjs → .tests/benchmarks/compute-benchmarks.task.mjs} +46 -51
  15. package/.tasks/.tests/benchmarks/run-benchmarks-for-backend.task.mjs +39 -0
  16. package/.tasks/.tests/benchmarks/run-benchmarks-for-frontend.task.mjs +41 -0
  17. package/.tasks/.tests/benchmarks/run-benchmarks.task.mjs +18 -0
  18. package/.tasks/{tests/bundling/check-bundling-from-esm-build-import.mjs → .tests/bundling/check-bundling-from-esm-build-import.task.mjs} +31 -75
  19. package/.tasks/.tests/bundling/check-bundling-from-esm-files-direct.task.mjs +77 -0
  20. package/.tasks/.tests/bundling/check-bundling-from-esm-files-import.task.mjs +95 -0
  21. package/.tasks/.tests/bundling/check-bundling.task.mjs +20 -0
  22. package/.tasks/.tests/run-tests.task.mjs +18 -0
  23. package/.tasks/.tests/unit-tests/build-unit-tests-backend.task.mjs +42 -0
  24. package/.tasks/{tests/unit-tests/compute-unit-tests.mjs → .tests/unit-tests/compute-unit-tests.task.mjs} +152 -193
  25. package/.tasks/.tests/unit-tests/run-unit-tests-for-backend.task.mjs +44 -0
  26. package/.tasks/.tests/unit-tests/run-unit-tests-for-frontend.task.mjs +41 -0
  27. package/.tasks/.tests/unit-tests/run-unit-tests.task.mjs +18 -0
  28. package/.tasks/_refresh-gulpfile.task.mjs +65 -0
  29. package/.tasks/_utils.mjs +159 -33
  30. package/.tasks/configs/benchmarks.conf.mjs +57 -0
  31. package/.tasks/configs/build-benchmarks-backend.conf.mjs +51 -0
  32. package/.tasks/configs/build-unit-tests-backend.conf.mjs +46 -0
  33. package/.tasks/configs/build.conf.mjs +354 -0
  34. package/.tasks/configs/check-bundling.conf.mjs +26 -0
  35. package/.tasks/configs/clean.conf.mjs +9 -0
  36. package/.tasks/configs/compute-benchmarks.conf.mjs +28 -0
  37. package/.tasks/configs/compute-unit-tests.conf.mjs +27 -0
  38. package/.tasks/configs/doc.conf.json +50 -0
  39. package/.tasks/configs/eslint.conf.mjs +121 -0
  40. package/.tasks/configs/units.conf.mjs +27 -0
  41. package/.tasks/itee-benchmarks-framework.js +186 -0
  42. package/.tasks/itee-reporter.mjs +217 -0
  43. package/CHANGELOG.md +12 -0
  44. package/builds/itee-validators.cjs.js +53 -15
  45. package/builds/itee-validators.cjs.js.map +1 -1
  46. package/builds/itee-validators.cjs.min.js +36 -35
  47. package/builds/itee-validators.esm.js +25 -2
  48. package/builds/itee-validators.esm.js.map +1 -1
  49. package/builds/itee-validators.esm.min.js +3 -3
  50. package/builds/itee-validators.iife.js +25 -4
  51. package/builds/itee-validators.iife.js.map +1 -1
  52. package/builds/itee-validators.iife.min.js +10 -10
  53. package/package.json +49 -41
  54. package/sources/cores/_cores.js +10 -10
  55. package/sources/cores/arrays/_arrays.js +12 -12
  56. package/sources/cores/arrays/isArrayOfArray.js +2 -2
  57. package/sources/cores/arrays/isArrayOfBoolean.js +3 -3
  58. package/sources/cores/arrays/isArrayOfFunction.js +3 -3
  59. package/sources/cores/arrays/isArrayOfMultiElement.js +1 -1
  60. package/sources/cores/arrays/isArrayOfNull.js +3 -3
  61. package/sources/cores/arrays/isArrayOfNumber.js +3 -3
  62. package/sources/cores/arrays/isArrayOfObject.js +3 -3
  63. package/sources/cores/arrays/isArrayOfSingleElement.js +1 -1
  64. package/sources/cores/arrays/isArrayOfString.js +3 -3
  65. package/sources/cores/arrays/isArrayOfUndefined.js +3 -3
  66. package/sources/cores/arrays/isEmptyArray.js +1 -1
  67. package/sources/cores/booleans/_booleans.js +2 -2
  68. package/sources/cores/booleans/isTrue.js +1 -1
  69. package/sources/cores/cores.js +8 -8
  70. package/sources/cores/functions/_functions.js +1 -1
  71. package/sources/cores/numbers/_numbers.js +6 -6
  72. package/sources/cores/numbers/isNumber.js +3 -3
  73. package/sources/cores/objects/_objects.js +2 -2
  74. package/sources/cores/objects/isEmptyObject.js +1 -1
  75. package/sources/cores/objects/isObject.js +1 -1
  76. package/sources/cores/strings/_strings.js +3 -3
  77. package/sources/cores/strings/isBlankString.js +2 -2
  78. package/sources/cores/strings/isEmptyString.js +1 -1
  79. package/sources/cores/symbols/_symbols.js +1 -1
  80. package/sources/cores/tests/isTestUnitGenerator.js +5 -6
  81. package/sources/cores/typed-arrays/_typedArrays.js +12 -12
  82. package/sources/cores/voids/_voids.js +4 -4
  83. package/sources/cores/voids/isEmpty.js +4 -4
  84. package/sources/file-system/_file-system.js +9 -9
  85. package/sources/file-system/block-devices/_blockDevices.js +3 -3
  86. package/sources/file-system/block-devices/isBlockDevicePath.js +3 -3
  87. package/sources/file-system/block-devices/isValidBlockDevicePath.js +2 -2
  88. package/sources/file-system/character-devices/_characterDevices.js +3 -3
  89. package/sources/file-system/character-devices/isCharacterDevicePath.js +3 -3
  90. package/sources/file-system/character-devices/isValidCharacterDevicePath.js +2 -2
  91. package/sources/file-system/directories/_directories.js +4 -4
  92. package/sources/file-system/directories/isDirectoryPath.js +3 -3
  93. package/sources/file-system/directories/isEmptyDirectory.js +2 -2
  94. package/sources/file-system/directories/isValidDirectoryPath.js +2 -2
  95. package/sources/file-system/fifo-pipes/_fifoPipes.js +3 -3
  96. package/sources/file-system/fifo-pipes/isFIFOPath.js +3 -3
  97. package/sources/file-system/fifo-pipes/isValidFIFOPath.js +2 -2
  98. package/sources/file-system/files/_files.js +4 -4
  99. package/sources/file-system/files/isEmptyFile.js +3 -3
  100. package/sources/file-system/files/isFilePath.js +3 -3
  101. package/sources/file-system/files/isValidFilePath.js +2 -2
  102. package/sources/file-system/paths/_paths.js +2 -2
  103. package/sources/file-system/paths/isValidPath.js +1 -1
  104. package/sources/file-system/sockets/_sockets.js +3 -3
  105. package/sources/file-system/sockets/isSocketPath.js +3 -3
  106. package/sources/file-system/sockets/isValidSocketPath.js +2 -2
  107. package/sources/file-system/symbolic-links/_symbolicLinks.js +3 -3
  108. package/sources/file-system/symbolic-links/isSymbolicLinkPath.js +3 -3
  109. package/sources/file-system/symbolic-links/isValidSymbolicLinkPath.js +2 -2
  110. package/sources/itee-validators.js +4 -4
  111. package/sources/maths/_maths.js +1 -1
  112. package/sources/physics/_physics.js +2 -2
  113. package/sources/physics/temperatures/_temperatures.js +5 -5
  114. package/sources/physics/temperatures/isCelsius.js +2 -2
  115. package/sources/physics/temperatures/isFahrenheit.js +2 -2
  116. package/sources/physics/temperatures/isKelvin.js +2 -2
  117. package/sources/physics/temperatures/isTemperature.js +3 -3
  118. package/.tasks/builds/build.mjs +0 -65
  119. package/.tasks/cleans/clean.mjs +0 -20
  120. package/.tasks/docs/doc.mjs +0 -37
  121. package/.tasks/helps/help.mjs +0 -195
  122. package/.tasks/lints/lint.mjs +0 -33
  123. package/.tasks/patches/patch.mjs +0 -9
  124. package/.tasks/tests/benchmarks/bundle-benchmarks.mjs +0 -33
  125. package/.tasks/tests/benchmarks/run-benchmarks-for-backend.mjs +0 -24
  126. package/.tasks/tests/benchmarks/run-benchmarks-for-frontend.mjs +0 -38
  127. package/.tasks/tests/bundling/check-bundling-from-esm-files-direct.mjs +0 -129
  128. package/.tasks/tests/bundling/check-bundling-from-esm-files-import.mjs +0 -149
  129. package/.tasks/tests/unit-tests/bundle-unit-tests.mjs +0 -33
  130. package/.tasks/tests/unit-tests/run-unit-tests-for-backend.mjs +0 -25
  131. package/.tasks/tests/unit-tests/run-unit-tests-for-frontend.mjs +0 -41
@@ -0,0 +1,44 @@
1
+ import colors from 'ansi-colors'
2
+ import { spawn } from 'child_process'
3
+ import log from 'fancy-log'
4
+ import { existsSync } from 'fs'
5
+ import { join } from 'path'
6
+ import {
7
+ nodeModulesDirectory,
8
+ packageName,
9
+ packageTestsUnitsDirectory
10
+ } from '../../_utils.mjs'
11
+
12
+ const {
13
+ red,
14
+ yellow,
15
+ } = colors
16
+
17
+ /**
18
+ * @description Will run unit tests with node
19
+ */
20
+ const runUnitTestsForBackendTask = ( done ) => {
21
+
22
+ const testsPath = join( packageTestsUnitsDirectory, `/builds/${ packageName }.units.cjs.js` )
23
+ if ( !existsSync( testsPath ) ) {
24
+ log( yellow( `${ testsPath } does not exist, skip backend unit tests...` ) )
25
+ done()
26
+ return
27
+ }
28
+
29
+ const mochaPath = join( nodeModulesDirectory, '/mocha/bin/mocha' )
30
+ const mocha = spawn( 'node', [ mochaPath, testsPath ], { stdio: 'inherit' } )
31
+ mocha.on( 'close', ( code ) => {
32
+
33
+ ( code === 0 )
34
+ ? done()
35
+ : done( red( `mocha exited with code ${ code }` ) )
36
+
37
+ } )
38
+
39
+ }
40
+ runUnitTestsForBackendTask.displayName = 'run-unit-tests-for-backend'
41
+ runUnitTestsForBackendTask.description = 'Will run unit tests with node'
42
+ runUnitTestsForBackendTask.flags = null
43
+
44
+ export { runUnitTestsForBackendTask }
@@ -0,0 +1,41 @@
1
+ import { startTestRunner } from '@web/test-runner'
2
+ import colors from 'ansi-colors'
3
+ import { default as config } from '../../configs/units.conf.mjs'
4
+
5
+ const { red } = colors
6
+
7
+ /**
8
+ * @description Will run unit tests with web-test-runner
9
+ */
10
+ const runUnitTestsForFrontendTask = () => {
11
+ return new Promise( async ( resolve, reject ) => {
12
+
13
+ const testRunner = await startTestRunner( {
14
+ config: config,
15
+ readCliArgs: false,
16
+ readFileConfig: false,
17
+ autoExitProcess: false,
18
+ } )
19
+
20
+ if ( !testRunner ) {
21
+ reject( red( 'Internal test runner error.' ) )
22
+ return
23
+ }
24
+
25
+ // To ensure that testRunner exit event won't be used by other instance of test runner,
26
+ // we need to be sure that current test runner is ended
27
+ testRunner.on( 'finished', () => {
28
+ testRunner.stop()
29
+ } )
30
+
31
+ testRunner.on( 'stopped', () => {
32
+ resolve()
33
+ } )
34
+
35
+ } )
36
+ }
37
+ runUnitTestsForFrontendTask.displayName = 'run-unit-tests-for-frontend'
38
+ runUnitTestsForFrontendTask.description = 'Will run unit tests with web-test-runner'
39
+ runUnitTestsForFrontendTask.flags = null
40
+
41
+ export { runUnitTestsForFrontendTask }
@@ -0,0 +1,18 @@
1
+ import { series } from 'gulp'
2
+ import { runUnitTestsForBackendTask } from './run-unit-tests-for-backend.task.mjs'
3
+ import { runUnitTestsForFrontendTask } from './run-unit-tests-for-frontend.task.mjs'
4
+
5
+ /**
6
+ * @method npm run build-test
7
+ * @global
8
+ * @description Will run unit tests in back and front environments
9
+ */
10
+ const runUnitTestsTask = series(
11
+ runUnitTestsForBackendTask,
12
+ runUnitTestsForFrontendTask,
13
+ )
14
+ runUnitTestsTask.displayName = 'run-unit-tests'
15
+ runUnitTestsTask.description = 'Will run unit tests in back and front environments.'
16
+ runUnitTestsTask.flags = null
17
+
18
+ export { runUnitTestsTask }
@@ -0,0 +1,65 @@
1
+ import colors from 'ansi-colors'
2
+ import log from 'fancy-log'
3
+ import { writeFileSync } from 'fs'
4
+ import { glob } from 'glob'
5
+ import {
6
+ join,
7
+ normalize,
8
+ relative
9
+ } from 'path'
10
+ import { packageRootDirectory } from './_utils.mjs'
11
+
12
+ const {
13
+ blue,
14
+ green,
15
+ magenta,
16
+ cyan
17
+ } = colors
18
+ const gulpfilePath = join( packageRootDirectory, 'gulpfile.mjs' )
19
+ const taskFiles = glob.sync( join( packageRootDirectory, '.tasks/{.*.task.mjs,*.task.mjs,.**/*.task.mjs,.**/**/*.task.mjs}' ) )
20
+ .map( filePath => normalize( filePath ) )
21
+
22
+ /**
23
+ * @method gulp refresh
24
+ * @global
25
+ * @description Will regenerate the gulpfile accordingly to existing task under .tasks folder
26
+ */
27
+ const _refreshGulpfileTask = async ( done ) => {
28
+
29
+ let gulpfileContent = '' +
30
+ '/**\n' +
31
+ ' * This file is auto-generated by internal gulp command.\n' +
32
+ ' * If you want to customize the available gulp tasks, create your own in .tasks folder\n' +
33
+ ' * and run "gulp refresh"\n' +
34
+ ' */\n\n'
35
+
36
+ for ( const taskFile of taskFiles ) {
37
+ const module = await import(taskFile)
38
+
39
+ const exportStrings = []
40
+ for ( const moduleKey in module ) {
41
+ const task = module[ moduleKey ]
42
+ const name = task.name ?? null
43
+ const displayName = task.displayName ?? null
44
+ const fullName = ( moduleKey !== name ) ? `${ blue( moduleKey ) }( ${ magenta( name ) } )` : `${ blue( name ) }`
45
+ const exportAs = ( displayName ) ? ` as ${ cyan( displayName ) }` : ''
46
+ const exportString = fullName + exportAs
47
+ exportStrings.push( exportString )
48
+ }
49
+
50
+ const relativeTaskFile = relative( packageRootDirectory, taskFile )
51
+ log( 'Found', green( relativeTaskFile ), 'with', exportStrings.join( ', ' ) )
52
+ gulpfileContent += `export * from './${ relativeTaskFile }'\n`
53
+ }
54
+
55
+ log( 'Refreshing', green( gulpfilePath ) )
56
+ writeFileSync( gulpfilePath, gulpfileContent )
57
+
58
+ done()
59
+
60
+ }
61
+ _refreshGulpfileTask.displayName = 'refresh'
62
+ _refreshGulpfileTask.description = 'Will regenerate gulpfile.mjs with tasks in .tasks folder and sub-folders'
63
+ _refreshGulpfileTask.flags = null
64
+
65
+ export { _refreshGulpfileTask }
package/.tasks/_utils.mjs CHANGED
@@ -1,12 +1,16 @@
1
+ import colors from 'ansi-colors'
2
+ import childProcess from 'child_process'
3
+ import log from 'fancy-log'
4
+ import { readFileSync } from 'fs'
1
5
  import {
2
- join,
3
- dirname
6
+ dirname,
7
+ join
4
8
  } from 'path'
5
- import { readFileSync } from 'fs'
6
9
  import { fileURLToPath } from 'url'
7
10
 
8
- // We cannot use directly the import.meta.dirname or filename because all IDE usage do not produce them
9
- // We use
11
+ const red = colors.red
12
+ const yellow = colors.yellow
13
+
10
14
  function getDirname() {
11
15
 
12
16
  let __dirname
@@ -22,45 +26,167 @@ function getDirname() {
22
26
  throw new Error( 'Unable to retrieve module dirname.' )
23
27
  }
24
28
 
25
- // Todo: distinguish between dirname and packageRootFolder to avoid misusing
26
- __dirname = join( __dirname, '..' )
27
-
28
29
  return __dirname
29
30
 
30
31
  }
31
32
 
32
- const __dirname = getDirname()
33
- const packagePath = join( __dirname, 'package.json' )
34
- const packageData = readFileSync( packagePath )
35
- const packageInfos = JSON.parse( packageData )
33
+ function getPackageRootDirectory() {
36
34
 
37
- class Indenter {
35
+ const __dirname = getDirname()
36
+ return join( __dirname, '..' )
37
+
38
+ }
39
+
40
+ const packageRootDirectory = getPackageRootDirectory()
41
+ const packageJsonPath = join( packageRootDirectory, 'package.json' )
42
+ const nodeModulesDirectory = join( packageRootDirectory, 'node_modules' )
43
+ const packageBuildsDirectory = join( packageRootDirectory, 'builds' )
44
+ const packageSourcesDirectory = join( packageRootDirectory, 'sources' )
45
+ const packageSourcesBackendDirectory = join( packageSourcesDirectory, 'backend' )
46
+ const packageSourcesCommonDirectory = join( packageSourcesDirectory, 'common' )
47
+ const packageSourcesFrontendDirectory = join( packageSourcesDirectory, 'frontend' )
48
+ const packageTestsDirectory = join( packageRootDirectory, 'tests' )
49
+ const packageTestsBenchmarksDirectory = join( packageTestsDirectory, 'benchmarks' )
50
+ const packageTestsBundlesDirectory = join( packageTestsDirectory, 'bundles' )
51
+ const packageTestsUnitsDirectory = join( packageTestsDirectory, 'units' )
52
+ const packageDocsDirectory = join( packageRootDirectory, 'docs' )
53
+ const packageTutorialsDirectory = join( packageRootDirectory, 'tutorials' )
54
+
55
+ function getPackageJson() {
56
+
57
+ const packageData = readFileSync( packageJsonPath )
58
+ return JSON.parse( packageData )
59
+
60
+ }
61
+
62
+ const packageJson = getPackageJson()
63
+ const packageName = packageJson.name
64
+ const packageVersion = packageJson.version
65
+ const packageDescription = packageJson.description
66
+
67
+ function getPrettyPackageName( separator = ' ' ) {
68
+
69
+ let prettyPackageName = ''
38
70
 
39
- _ = ''
40
- __ = ''
41
- ___ = ''
42
- ____ = ''
43
- _____ = ''
44
- ______ = ''
45
- _______ = ''
46
- ________ = ''
47
- _________ = ''
48
- __________ = ''
49
-
50
- constructor( indentationChar = '\t', maxIndentationLevel = 10 ) {
51
-
52
- let currentProperty = '_'
53
- for ( let currentIndentationLevel = 1 ; currentIndentationLevel <= maxIndentationLevel ; currentIndentationLevel++ ) {
54
- this[ currentProperty ] = indentationChar.repeat( currentIndentationLevel )
55
- currentProperty += '_'
71
+ const nameSplits = packageName.split( '-' )
72
+ for ( const nameSplit of nameSplits ) {
73
+ prettyPackageName += nameSplit.charAt( 0 ).toUpperCase() + nameSplit.slice( 1 ) + separator
74
+ }
75
+ prettyPackageName = prettyPackageName.slice( 0, -1 )
76
+
77
+ return prettyPackageName
78
+
79
+ }
80
+
81
+ function getPrettyPackageVersion() {
82
+
83
+ return 'v' + packageVersion
84
+
85
+ }
86
+
87
+ function getPrettyNodeVersion() {
88
+
89
+ let nodeVersion = 'vX.x.ₓ'
90
+
91
+ try {
92
+ nodeVersion = childProcess.execFileSync( 'node', [ '--version' ] )
93
+ .toString()
94
+ .replace( /(\r\n|\n|\r)/gm, '' )
95
+ } catch ( e ) {
96
+ log( red( e ) )
97
+
98
+ if ( e.message.includes( 'ENOENT' ) ) {
99
+ nodeVersion += yellow( ' Not seems to be accessible from the path environment.' )
56
100
  }
101
+ }
102
+
103
+ return ' node: ' + nodeVersion
57
104
 
105
+ }
106
+
107
+ function getPrettyNpmVersion() {
108
+
109
+ let npmVersion = 'X.x.ₓ'
110
+
111
+ try {
112
+ npmVersion = childProcess.execFileSync( 'npm', [ '--version' ] )
113
+ .toString()
114
+ .replace( /(\r\n|\n|\r)/gm, '' )
115
+ } catch ( e ) {
116
+ log( red( e ) )
117
+
118
+ if ( e.message.includes( 'ENOENT' ) ) {
119
+ npmVersion += yellow( ' Not seems to be accessible from the path environment.' )
120
+ }
121
+ }
122
+
123
+ return ' npm: v' + npmVersion
124
+
125
+ }
126
+
127
+ function IndenterFactory( indentationChar = '\t', indentationLevel = 5 ) {
128
+
129
+ const indentationLevels = {}
130
+ let currentProperty = 'I_'
131
+ for ( let currentIndentationLevel = 1 ; currentIndentationLevel <= indentationLevel ; currentIndentationLevel++ ) {
132
+ indentationLevels[ currentProperty ] = indentationChar.repeat( currentIndentationLevel )
133
+ currentProperty += '_'
134
+ }
135
+
136
+ return {
137
+ I: new Indenter( indentationChar ),
138
+ ...indentationLevels
139
+ }
140
+
141
+ }
142
+
143
+ class Indenter {
144
+
145
+ constructor( indentationChar = '\t' ) {
146
+
147
+ this.indentationChar = indentationChar
148
+ this.currentIndentationLevel = 0
149
+
150
+ }
151
+
152
+ _( indentationLevel = null ) {
153
+ return this.indentationChar.repeat( indentationLevel ?? this.currentIndentationLevel )
154
+ }
155
+
156
+ deeper( level = 1 ) {
157
+ this.currentIndentationLevel += level
158
+ }
159
+
160
+ shallower( level = 1 ) {
161
+ this.currentIndentationLevel -= level
58
162
  }
59
163
 
60
164
  }
61
165
 
62
166
  export {
63
- packageInfos,
64
- Indenter,
65
- getDirname
167
+ packageRootDirectory,
168
+ packageJsonPath,
169
+ packageBuildsDirectory,
170
+ packageSourcesDirectory,
171
+ packageSourcesBackendDirectory,
172
+ packageSourcesCommonDirectory,
173
+ packageSourcesFrontendDirectory,
174
+ packageTestsDirectory,
175
+ packageTestsBenchmarksDirectory,
176
+ packageTestsBundlesDirectory,
177
+ packageTestsUnitsDirectory,
178
+ packageDocsDirectory,
179
+ packageTutorialsDirectory,
180
+ nodeModulesDirectory,
181
+
182
+ packageJson,
183
+ packageName,
184
+ packageVersion,
185
+ packageDescription,
186
+ getPrettyPackageName,
187
+ getPrettyPackageVersion,
188
+ getPrettyNodeVersion,
189
+ getPrettyNpmVersion,
190
+
191
+ IndenterFactory as Indenter
66
192
  }
@@ -0,0 +1,57 @@
1
+ import { playwrightLauncher } from '@web/test-runner-playwright'
2
+ import { packageRootDirectory } from '../_utils.mjs'
3
+ import { iteeReporter } from '../itee-reporter.mjs'
4
+
5
+ export default {
6
+ files: [
7
+ // 'tests/benchmarks/cores/arrays/isArray.bench.js',
8
+
9
+ // 'tests/benchmarks/cores/arrays/*.bench.js',
10
+ // 'tests/benchmarks/cores/booleans/*.bench.js',
11
+ // 'tests/benchmarks/cores/functions/*.bench.js',
12
+ // 'tests/benchmarks/cores/numbers/*.bench.js',
13
+ // 'tests/benchmarks/cores/objects/*.bench.js',
14
+ // 'tests/benchmarks/cores/strings/*.bench.js',
15
+ // 'tests/benchmarks/cores/symbols/*.bench.js',
16
+ // 'tests/benchmarks/cores/typed-arrays/*.bench.js',
17
+ // 'tests/benchmarks/cores/voids/*.bench.js',
18
+ // 'tests/benchmarks/cores/**',
19
+ // 'tests/benchmarks/dom/**',
20
+ // 'tests/benchmarks/physics/**',
21
+ // OR
22
+ // 'tests/benchmarks/builds/itee-validators.benchmarks.iife.js',
23
+ // OR
24
+ 'tests/benchmarks/**/*.bench.js',
25
+ '!tests/benchmarks/builds/**',
26
+ '!tests/benchmarks/file-system/**',
27
+ ],
28
+ debug: false,
29
+ nodeResolve: true,
30
+ browsers: [
31
+ playwrightLauncher( { product: 'chromium' } ),
32
+ playwrightLauncher( { product: 'webkit' } ),
33
+ playwrightLauncher( { product: 'firefox' } ),
34
+ ],
35
+ testFramework: {
36
+ path: packageRootDirectory + '/.tasks/itee-benchmarks-framework.js',
37
+ config: {
38
+ foo: 'bar'
39
+ }
40
+ },
41
+ testRunnerHtml: testFramework => `
42
+ <!DOCTYPE html>
43
+ <html>
44
+ <body>
45
+ <script type="module" src="node_modules/lodash/lodash.js"></script>
46
+ <script type="module" src="node_modules/platform/platform.js"></script>
47
+ <script type="module" src="node_modules/benchmark/benchmark.js"></script>
48
+ <script type="module" src="${ testFramework }"></script>
49
+ </body>
50
+ </html>
51
+ `,
52
+ reporters: [
53
+ iteeReporter( {
54
+ reportProgress: true
55
+ } )
56
+ ]
57
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
3
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
4
+ *
5
+ * @module configs/Rollup
6
+ * @description The file manage the rollup configuration for build the library using differents arguments. It allow to build with two type of environment (dev and prod), and differents output format.
7
+ * Use npm run help to display all available build options.
8
+ *
9
+ * @requires {@link module: [rollup-plugin-commonjs]{@link https://github.com/rollup/rollup-plugin-commonjs}}
10
+ * @requires {@link module: [path]{@link https://nodejs.org/api/path.html}}
11
+ * @requires {@link module: [rollup-plugin-re]{@link https://github.com/jetiny/rollup-plugin-re}}
12
+ * @requires {@link module: [rollup-plugin-node-resolve]{@link https://github.com/rollup/rollup-plugin-node-resolve}}
13
+ * @requires {@link module: [rollup-plugin-terser]{@link https://github.com/TrySound/rollup-plugin-terser}}
14
+ */
15
+ import nodeResolve from '@rollup/plugin-node-resolve'
16
+ import cleanup from 'rollup-plugin-cleanup'
17
+ import replace from 'rollup-plugin-re'
18
+ import { packageName } from '../_utils.mjs'
19
+
20
+ const buildBenchmarksBackendConfig = {
21
+ input: `tests/benchmarks/${ packageName }.benchmarks.js`,
22
+ external: [
23
+ // 'fs'
24
+ ],
25
+ plugins: [
26
+ replace( {
27
+ // Even this variable are not used in this package, we need it because
28
+ // they are used in dependency package itee-utils that use them to focus some build stuff
29
+ // May be there is a better way to perform this specification than using global comment variable
30
+ // that need to be inherited in all children package
31
+ defines: {
32
+ IS_KEEP_ON_BUILD: true,
33
+ IS_BACKEND_SPECIFIC: true,
34
+ IS_FRONTEND_SPECIFIC: false,
35
+ }
36
+ } ),
37
+ nodeResolve(),
38
+ cleanup( {
39
+ comments: 'none'
40
+ } )
41
+ ],
42
+ treeshake: true,
43
+ output: {
44
+ indent: '\t',
45
+ format: 'cjs',
46
+ intro: () => 'var Benchmark = require(\'benchmark\')',
47
+ file: `tests/benchmarks/builds/${ packageName }.benchmarks.cjs.js`
48
+ }
49
+ }
50
+
51
+ export { buildBenchmarksBackendConfig }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
3
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
4
+ *
5
+ * @module configs/Rollup
6
+ * @description The file manage the rollup configuration for build the library using differents arguments. It allow to build with two type of environment (dev and prod), and differents output format.
7
+ * Use npm run help to display all available build options.
8
+ *
9
+ * @requires {@link module: [rollup-plugin-commonjs]{@link https://github.com/rollup/rollup-plugin-commonjs}}
10
+ * @requires {@link module: [path]{@link https://nodejs.org/api/path.html}}
11
+ * @requires {@link module: [rollup-plugin-re]{@link https://github.com/jetiny/rollup-plugin-re}}
12
+ * @requires {@link module: [rollup-plugin-node-resolve]{@link https://github.com/rollup/rollup-plugin-node-resolve}}
13
+ * @requires {@link module: [rollup-plugin-terser]{@link https://github.com/TrySound/rollup-plugin-terser}}
14
+ */
15
+ import nodeResolve from '@rollup/plugin-node-resolve'
16
+ import cleanup from 'rollup-plugin-cleanup'
17
+ import replace from 'rollup-plugin-re'
18
+ import { packageName } from '../_utils.mjs'
19
+
20
+ /**
21
+ * @type {{input: string, external: string[], plugins: (Plugin<any>|{name: string, transform: function(*, *): (undefined|{code: *})})[], treeshake: boolean, output: {indent: string, format: string, file: string}}}
22
+ */
23
+ const buildUnitTestsBackendConfig = {
24
+ input: `tests/units/${ packageName }.units.mjs`,
25
+ external: [ 'itee-utils', 'mocha', 'chai', 'fs' ],
26
+ plugins: [
27
+ nodeResolve(),
28
+ replace( {
29
+ replaces: {
30
+ 'isEventTargetUnits.call': '//isEventTargetUnits.call',
31
+ }
32
+ } ),
33
+ cleanup( {
34
+ comments: 'none'
35
+ } )
36
+ ],
37
+ treeshake: true,
38
+ output: {
39
+ indent: '\t',
40
+ format: 'cjs',
41
+ // inlineDynamicImports: true,
42
+ file: `tests/units/builds/${ packageName }.units.cjs.js`
43
+ }
44
+ }
45
+
46
+ export { buildUnitTestsBackendConfig }