itee-validators 6.0.0 → 6.1.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 (61) hide show
  1. package/.github/workflows/publish.yml +61 -0
  2. package/.tasks/configs/lints/lint.conf.mjs +42 -0
  3. package/.tasks/configs/tests/benchmarks/compute-benchmarks.conf.mjs +5 -0
  4. package/.tasks/configs/tests/benchmarks/run-benchmarks-for-frontend.conf.mjs +5 -0
  5. package/.tasks/configs/tests/units/run-unit-tests-for-frontend.conf.mjs +5 -0
  6. package/CHANGELOG.md +13 -0
  7. package/builds/{itee-validators.cjs.js → validators.cjs} +3 -3
  8. package/builds/validators.cjs.map +1 -0
  9. package/builds/{itee-validators.iife.js → validators.js} +3 -3
  10. package/builds/validators.js.map +1 -0
  11. package/builds/{itee-validators.esm.js → validators.mjs} +3 -3
  12. package/builds/validators.mjs.map +1 -0
  13. package/package.json +9 -42
  14. package/.github/workflows/node.js.yml +0 -53
  15. package/.tasks/.builds/build-benchmarks.task.mjs +0 -16
  16. package/.tasks/.builds/build-tests.task.mjs +0 -18
  17. package/.tasks/.builds/build-unit-tests.task.mjs +0 -16
  18. package/.tasks/.builds/build.task.mjs +0 -46
  19. package/.tasks/.cleans/clean.task.mjs +0 -23
  20. package/.tasks/.docs/doc.task.mjs +0 -35
  21. package/.tasks/.helps/help.task.mjs +0 -151
  22. package/.tasks/.lints/lint.task.mjs +0 -37
  23. package/.tasks/.patches/patch.task.mjs +0 -13
  24. package/.tasks/.releases/release.task.mjs +0 -26
  25. package/.tasks/.tests/benchmarks/build-benchmarks-backend.task.mjs +0 -42
  26. package/.tasks/.tests/benchmarks/compute-benchmarks.task.mjs +0 -210
  27. package/.tasks/.tests/benchmarks/run-benchmarks-for-backend.task.mjs +0 -39
  28. package/.tasks/.tests/benchmarks/run-benchmarks-for-frontend.task.mjs +0 -41
  29. package/.tasks/.tests/benchmarks/run-benchmarks.task.mjs +0 -18
  30. package/.tasks/.tests/bundling/check-bundling-from-esm-build-import.task.mjs +0 -123
  31. package/.tasks/.tests/bundling/check-bundling-from-esm-files-direct.task.mjs +0 -77
  32. package/.tasks/.tests/bundling/check-bundling-from-esm-files-import.task.mjs +0 -95
  33. package/.tasks/.tests/bundling/check-bundling.task.mjs +0 -20
  34. package/.tasks/.tests/run-tests.task.mjs +0 -18
  35. package/.tasks/.tests/unit-tests/build-unit-tests-backend.task.mjs +0 -42
  36. package/.tasks/.tests/unit-tests/compute-unit-tests.task.mjs +0 -537
  37. package/.tasks/.tests/unit-tests/run-unit-tests-for-backend.task.mjs +0 -44
  38. package/.tasks/.tests/unit-tests/run-unit-tests-for-frontend.task.mjs +0 -41
  39. package/.tasks/.tests/unit-tests/run-unit-tests.task.mjs +0 -18
  40. package/.tasks/_refresh-gulpfile.task.mjs +0 -65
  41. package/.tasks/_utils.mjs +0 -192
  42. package/.tasks/configs/benchmarks.conf.mjs +0 -57
  43. package/.tasks/configs/build-benchmarks-backend.conf.mjs +0 -51
  44. package/.tasks/configs/build-unit-tests-backend.conf.mjs +0 -46
  45. package/.tasks/configs/build.conf.mjs +0 -354
  46. package/.tasks/configs/check-bundling.conf.mjs +0 -26
  47. package/.tasks/configs/clean.conf.mjs +0 -9
  48. package/.tasks/configs/compute-benchmarks.conf.mjs +0 -28
  49. package/.tasks/configs/compute-unit-tests.conf.mjs +0 -27
  50. package/.tasks/configs/doc.conf.json +0 -50
  51. package/.tasks/configs/eslint.conf.mjs +0 -121
  52. package/.tasks/configs/units.conf.mjs +0 -27
  53. package/.tasks/itee-benchmarks-framework.js +0 -186
  54. package/.tasks/itee-reporter.mjs +0 -217
  55. package/builds/itee-validators.cjs.js.map +0 -1
  56. package/builds/itee-validators.esm.js.map +0 -1
  57. package/builds/itee-validators.iife.js.map +0 -1
  58. /package/builds/{itee-validators.cjs.min.js → validators.min.cjs} +0 -0
  59. /package/builds/{itee-validators.iife.min.js → validators.min.js} +0 -0
  60. /package/builds/{itee-validators.esm.min.js → validators.min.mjs} +0 -0
  61. /package/sources/{itee-validators.js → validators.js} +0 -0
@@ -1,65 +0,0 @@
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 DELETED
@@ -1,192 +0,0 @@
1
- import colors from 'ansi-colors'
2
- import childProcess from 'child_process'
3
- import log from 'fancy-log'
4
- import { readFileSync } from 'fs'
5
- import {
6
- dirname,
7
- join
8
- } from 'path'
9
- import { fileURLToPath } from 'url'
10
-
11
- const red = colors.red
12
- const yellow = colors.yellow
13
-
14
- function getDirname() {
15
-
16
- let __dirname
17
-
18
- if ( import.meta.dirname ) {
19
- __dirname = import.meta.dirname
20
- } else if ( import.meta.filename ) {
21
- __dirname = dirname( import.meta.filename )
22
- } else if ( import.meta.url ) {
23
- const __filename = fileURLToPath( import.meta.url )
24
- __dirname = dirname( __filename )
25
- } else {
26
- throw new Error( 'Unable to retrieve module dirname.' )
27
- }
28
-
29
- return __dirname
30
-
31
- }
32
-
33
- function getPackageRootDirectory() {
34
-
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 = ''
70
-
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.' )
100
- }
101
- }
102
-
103
- return ' node: ' + nodeVersion
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
162
- }
163
-
164
- }
165
-
166
- export {
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
192
- }
@@ -1,57 +0,0 @@
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
- }
@@ -1,51 +0,0 @@
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 }
@@ -1,46 +0,0 @@
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 }