@itee/tasks 1.1.0 → 1.2.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 (63) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/configs/docs/doc.conf.mjs +55 -0
  3. package/docs/-_utils.mjs.html +848 -0
  4. package/docs/cleans_clean.task.mjs.html +239 -0
  5. package/docs/fonts/glyphicons-halflings-regular.eot +0 -0
  6. package/docs/fonts/glyphicons-halflings-regular.svg +288 -0
  7. package/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
  8. package/docs/fonts/glyphicons-halflings-regular.woff +0 -0
  9. package/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
  10. package/docs/global.html +1668 -0
  11. package/docs/helps_help.task.mjs.html +362 -0
  12. package/docs/img/glyphicons-halflings-white.png +0 -0
  13. package/docs/img/glyphicons-halflings.png +0 -0
  14. package/docs/index.html +228 -0
  15. package/docs/lints_lint.task.mjs.html +252 -0
  16. package/docs/patches_patch.task.mjs.html +251 -0
  17. package/docs/quicksearch.html +31 -0
  18. package/docs/releases_release.task.mjs.html +238 -0
  19. package/docs/scripts/docstrap.lib.js +11 -0
  20. package/docs/scripts/fulltext-search-ui.js +89 -0
  21. package/docs/scripts/fulltext-search.js +36 -0
  22. package/docs/scripts/lunr.min.js +6 -0
  23. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  24. package/docs/scripts/prettify/jquery.min.js +6 -0
  25. package/docs/scripts/prettify/lang-css.js +21 -0
  26. package/docs/scripts/prettify/prettify.js +496 -0
  27. package/docs/scripts/sunlight.js +1157 -0
  28. package/docs/scripts/toc.js +203 -0
  29. package/docs/styles/darkstrap.css +960 -0
  30. package/docs/styles/prettify-tomorrow.css +132 -0
  31. package/docs/styles/site.cerulean.css +7008 -0
  32. package/docs/styles/site.cosmo.css +7061 -0
  33. package/docs/styles/site.cyborg.css +7048 -0
  34. package/docs/styles/site.darkly.css +7171 -0
  35. package/docs/styles/site.darkstrap.css +5638 -0
  36. package/docs/styles/site.dibs-bootstrap.css +5899 -0
  37. package/docs/styles/site.flatly.css +7147 -0
  38. package/docs/styles/site.journal.css +6973 -0
  39. package/docs/styles/site.lumen.css +7298 -0
  40. package/docs/styles/site.paper.css +7623 -0
  41. package/docs/styles/site.readable.css +6997 -0
  42. package/docs/styles/site.sandstone.css +7035 -0
  43. package/docs/styles/site.simplex.css +7023 -0
  44. package/docs/styles/site.slate.css +7343 -0
  45. package/docs/styles/site.spacelab.css +7055 -0
  46. package/docs/styles/site.superhero.css +7131 -0
  47. package/docs/styles/site.united.css +6895 -0
  48. package/docs/styles/site.yeti.css +7195 -0
  49. package/docs/styles/sunlight.dark.css +345 -0
  50. package/docs/styles/sunlight.default.css +344 -0
  51. package/docs/tests_benchmarks_compute-benchmarks.task.mjs.html +442 -0
  52. package/docs/tests_benchmarks_run-benchmarks-for-backend.task.mjs.html +249 -0
  53. package/docs/tests_benchmarks_run-benchmarks-for-frontend.task.mjs.html +254 -0
  54. package/docs/tests_bundlings_check-bundling-from-esm-files-direct.task.mjs.html +300 -0
  55. package/docs/tests_bundlings_check-bundling.task.mjs.html +231 -0
  56. package/docs/tests_run-tests.task.mjs.html +228 -0
  57. package/docs/tests_units_compute-unit-tests.task.mjs.html +753 -0
  58. package/docs/tests_units_run-unit-tests-for-backend.task.mjs.html +254 -0
  59. package/docs/tests_units_run-unit-tests-for-frontend.task.mjs.html +254 -0
  60. package/package.json +5 -2
  61. package/sources/_utils.mjs +29 -3
  62. package/sources/patches/patch.task.mjs +45 -0
  63. package/configs/docs/doc.conf.json +0 -1
@@ -0,0 +1,442 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width">
7
+ <title>@itee/tasks v1.1.1 Source: tests/benchmarks/compute-benchmarks.task.mjs</title>
8
+
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/sunlight.dark.css">
13
+
14
+ <link type="text/css" rel="stylesheet" href="styles/site.cyborg.css">
15
+
16
+ </head>
17
+
18
+ <body>
19
+
20
+ <div class="navbar navbar-default navbar-fixed-top ">
21
+ <div class="container">
22
+ <div class="navbar-header">
23
+ <a class="navbar-brand" href="index.html">@itee/tasks v1.1.1</a>
24
+ <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
25
+ <span class="icon-bar"></span>
26
+ <span class="icon-bar"></span>
27
+ <span class="icon-bar"></span>
28
+ </button>
29
+ </div>
30
+ <div class="navbar-collapse collapse" id="topNavigation">
31
+ <ul class="nav navbar-nav">
32
+
33
+ <li class="dropdown">
34
+ <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
35
+ <ul class="dropdown-menu inline">
36
+ <li><a href="global.html#checkBundlingFromEsmFilesDirectTask">checkBundlingFromEsmFilesDirectTask</a></li><li><a href="global.html#checkBundlingTask">checkBundlingTask</a></li><li><a href="global.html#computeBenchmarksTask">computeBenchmarksTask</a></li><li><a href="global.html#computeUnitTestsTask">computeUnitTestsTask</a></li><li><a href="global.html#createRollupConfigs">createRollupConfigs</a></li><li><a href="global.html#npmrunclean">npm run clean</a></li><li><a href="global.html#npmrunhelpdefault">npm run help ( default )</a></li><li><a href="global.html#npmrunlint">npm run lint</a></li><li><a href="global.html#npmrunpatch">npm run patch</a></li><li><a href="global.html#npmrunrelease">npm run release</a></li><li><a href="global.html#npmruntest">npm run test</a></li><li><a href="global.html#runBenchmarksForBackendTask">runBenchmarksForBackendTask</a></li><li><a href="global.html#runBenchmarksForFrontendTask">runBenchmarksForFrontendTask</a></li><li><a href="global.html#runUnitTestsForBackendTask">runUnitTestsForBackendTask</a></li><li><a href="global.html#runUnitTestsForFrontendTask">runUnitTestsForFrontendTask</a></li>
37
+ </ul>
38
+ </li>
39
+
40
+ </ul>
41
+
42
+ <div class="col-sm-3 col-md-3">
43
+ <form class="navbar-form" role="search">
44
+ <div class="input-group">
45
+ <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
46
+ <div class="input-group-btn">
47
+ <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
48
+ </div>
49
+ </div>
50
+ </form>
51
+ </div>
52
+
53
+ </div>
54
+
55
+ </div>
56
+ </div>
57
+
58
+
59
+ <div class="container" id="toc-content">
60
+ <div class="row">
61
+
62
+
63
+ <div class="col-md-12">
64
+
65
+ <div id="main">
66
+
67
+
68
+ <h1 class="page-title">Source: tests/benchmarks/compute-benchmarks.task.mjs</h1>
69
+
70
+ <section>
71
+ <article>
72
+ <pre
73
+ class="sunlight-highlight-javascript linenums">import colors from 'ansi-colors'
74
+ import childProcess from 'child_process'
75
+ import log from 'fancy-log'
76
+ import { glob } from 'glob'
77
+ import {
78
+ basename,
79
+ dirname,
80
+ extname,
81
+ join,
82
+ normalize,
83
+ relative
84
+ } from 'path'
85
+ import {
86
+ createDirectoryIfNotExist,
87
+ createFile,
88
+ getTaskConfigurationFor,
89
+ logLoadingTask,
90
+ packageName,
91
+ packageNodeModulesDirectory,
92
+ packageSourcesDirectory,
93
+ packageTestsBenchmarksDirectory,
94
+ packageTestsDirectory
95
+ } from '../../_utils.mjs'
96
+
97
+ logLoadingTask( import.meta.filename )
98
+
99
+ const {
100
+ red,
101
+ yellow,
102
+ } = colors
103
+
104
+ /**
105
+ * @description Will generate benchmarks files from source code against provided alternatives
106
+ */
107
+ const computeBenchmarksTask = async ( done ) => {
108
+
109
+ createDirectoryIfNotExist( packageTestsBenchmarksDirectory )
110
+
111
+ // Get task configuration
112
+ const filePathsToIgnore = await getTaskConfigurationFor( import.meta.filename )
113
+
114
+ // Get source files to process
115
+ const pattern = join( packageSourcesDirectory, '**' )
116
+ const sourceFiles = glob.sync( pattern )
117
+ .map( filePath => normalize( filePath ) )
118
+ .filter( filePath => {
119
+ const fileName = basename( filePath )
120
+ const isJsFile = fileName.endsWith( '.js' )
121
+ const isNotPrivateFile = !fileName.startsWith( '_' )
122
+ const isNotIgnoredFile = !filePathsToIgnore.includes( fileName )
123
+ return isJsFile &amp;&amp; isNotPrivateFile &amp;&amp; isNotIgnoredFile
124
+ } )
125
+
126
+ const benchRootImports = []
127
+ for ( let sourceFile of sourceFiles ) {
128
+
129
+ const specificFilePath = sourceFile.replace( packageSourcesDirectory, '' )
130
+ const specificDir = dirname( specificFilePath )
131
+
132
+ const fileName = basename( sourceFile, extname( sourceFile ) )
133
+ const benchFileName = `${ fileName }.bench.js`
134
+ const benchDirPath = join( packageTestsBenchmarksDirectory, specificDir )
135
+ const benchFilePath = join( benchDirPath, benchFileName )
136
+
137
+ const nsName = `${ fileName }Namespace`
138
+ const importDirPath = relative( benchDirPath, packageSourcesDirectory )
139
+ const importFilePath = join( importDirPath, specificFilePath ).replace( /\\/g, '/' )
140
+
141
+ try {
142
+
143
+ const jsdocPath = join( packageNodeModulesDirectory, '/jsdoc/jsdoc.js' )
144
+ const jsdocOutput = childProcess.execFileSync( 'node', [ jsdocPath, '-X', sourceFile ] ).toString()
145
+
146
+ const classNames = []
147
+ const usedLongnames = []
148
+ const jsonData = JSON.parse( jsdocOutput ).filter( data => {
149
+
150
+ const longName = data.longname
151
+
152
+ const kind = data.kind
153
+ if ( kind !== 'function' ) {
154
+ if ( kind === 'class' &amp;&amp; !classNames.includes( longName ) ) {
155
+ classNames.push( longName )
156
+ }
157
+ return false
158
+ }
159
+
160
+ // We don't care that data bloc have comment they are unused to generate benchmarks
161
+ // const undocumented = data.undocumented
162
+ // if ( undocumented ) {
163
+ // return false
164
+ // }
165
+
166
+ const scope = data.scope
167
+ if ( ![ 'global', 'static' ].includes( scope ) ) {
168
+ return false
169
+ }
170
+
171
+ if ( longName.includes( ' ' ) || longName.includes( '~' ) || usedLongnames.includes( longName ) ) {
172
+ return false
173
+ }
174
+
175
+ for ( let className of classNames ) {
176
+ if ( longName.includes( className ) ) {
177
+ return false
178
+ }
179
+ }
180
+
181
+ usedLongnames.push( longName )
182
+
183
+ return true
184
+
185
+ } )
186
+
187
+ if ( jsonData.length === 0 ) {
188
+ log( 'Ignoring', yellow( `${ sourceFile }, no usable exports found` ) )
189
+ continue
190
+ }
191
+
192
+ // Compute benchmark suites by grouping logically function by name[_x]
193
+ const suiteGroups = {}
194
+ for ( let docData of jsonData ) {
195
+
196
+ try {
197
+
198
+ const functionName = docData.name
199
+ const nameSplits = functionName.split( '_' )
200
+ const rootName = nameSplits[ 0 ]
201
+
202
+ if ( !( rootName in suiteGroups ) ) {
203
+ suiteGroups[ rootName ] = []
204
+ }
205
+
206
+ suiteGroups[ rootName ].push( functionName )
207
+
208
+ } catch ( error ) {
209
+
210
+ log( red( error.message ) )
211
+
212
+ }
213
+
214
+ }
215
+
216
+ // Generate suites
217
+ let benchSuites = ''
218
+ const suitesToExports = []
219
+ for ( let suiteGroupName in suiteGroups ) {
220
+ suitesToExports.push( `${ suiteGroupName }Suite` )
221
+ benchSuites += `const ${ suiteGroupName }Suite = Benchmark.Suite( '${ nsName }.${ suiteGroupName }', Testing.createSuiteOptions() )` + '\n'
222
+
223
+ for ( let suiteGroupValue of suiteGroups[ suiteGroupName ] ) {
224
+ benchSuites += ` .add( '${ suiteGroupValue }()', Testing.iterateOverDataMap( ${ nsName }.${ suiteGroupValue } ), Testing.createBenchmarkOptions() )` + '\n'
225
+ }
226
+
227
+ benchSuites += '\n'
228
+ }
229
+
230
+ // compute relative level to get import wrappers
231
+ const wrapperDirPath = relative( benchDirPath, packageTestsDirectory )
232
+ const importBenchmarkFilePath = join( wrapperDirPath, 'import.benchmarks.js' )
233
+ const importTestingFilePath = join( wrapperDirPath, 'import.testing.js' )
234
+
235
+ const template = '' +
236
+ `import * as ${ nsName } from '${ importFilePath }'` + '\n' +
237
+ `import { getBenchmarkPackage } from '${ importBenchmarkFilePath }'` + '\n' +
238
+ `import { getTestingPackage } from '${ importTestingFilePath }'` + '\n' +
239
+ '\n' +
240
+ `const Benchmark = await getBenchmarkPackage()` + '\n' +
241
+ `const Testing = await getTestingPackage()` + '\n' +
242
+ '\n' +
243
+ `${ benchSuites }` +
244
+ // '\n' +
245
+ `export { ${ suitesToExports } }` + '\n' +
246
+ '\n'
247
+
248
+ const importBenchFilePath = relative( packageTestsBenchmarksDirectory, benchFilePath ).replace( /\\/g, '/' )
249
+ benchRootImports.push( {
250
+ path: importBenchFilePath,
251
+ exports: suitesToExports
252
+ } )
253
+
254
+ createDirectoryIfNotExist( benchDirPath )
255
+ createFile( benchFilePath, template )
256
+
257
+ } catch ( error ) {
258
+
259
+ log( red( error.message ) )
260
+
261
+ }
262
+
263
+ }
264
+
265
+ let templateImports = ''
266
+ let suites = []
267
+ for ( let i = 0 ; i &lt; benchRootImports.length ; i++ ) {
268
+
269
+ const currentBench = benchRootImports[ i ]
270
+ const namedExports = currentBench.exports
271
+ const imports = namedExports.join( ', ' )
272
+ suites.push( ...namedExports )
273
+
274
+ templateImports += `import {${ imports }} from './${ currentBench.path }'` + '\n'
275
+
276
+ }
277
+
278
+ // Use a fallback in case no benches were found at all
279
+ if ( benchRootImports.length === 0 ) {
280
+ log( 'Warning ', yellow( 'No usable exports found, generate default file to avoid frontend breakage.' ) )
281
+ const defaultBenchesDir = join( packageTestsBenchmarksDirectory, 'default' )
282
+ const defaultBenchesPath = join( defaultBenchesDir, 'default.bench.js' )
283
+
284
+ createDirectoryIfNotExist( defaultBenchesDir )
285
+ createFile( defaultBenchesPath, '// Avoid web test runner crash on empty benches' )
286
+ }
287
+
288
+ const benchesTemplate = '' +
289
+ `${ templateImports }` + '\n' +
290
+ 'const suites = [' + '\n' +
291
+ `${ suites.map( suite => `\t${ suite }` ).join( ',\n' ) }` + '\n' +
292
+ ']' + '\n' +
293
+ '\n' +
294
+ `for ( const suite of suites ) {` + '\n' +
295
+ `\tsuite.run()` + '\n' +
296
+ `}` + '\n'
297
+
298
+ const benchesFilePath = join( packageTestsBenchmarksDirectory, `${ packageName }.benchmarks.js` )
299
+ createFile( benchesFilePath, benchesTemplate )
300
+
301
+ done()
302
+
303
+ }
304
+ computeBenchmarksTask.displayName = basename( import.meta.filename, '.task.mjs' )
305
+ computeBenchmarksTask.description = 'Will generate benchmarks files from source code against provided alternatives.'
306
+ computeBenchmarksTask.flags = null
307
+
308
+ export { computeBenchmarksTask }</pre>
309
+ </article>
310
+ </section>
311
+
312
+
313
+
314
+
315
+
316
+ </div>
317
+ </div>
318
+
319
+ <div class="clearfix"></div>
320
+
321
+
322
+
323
+ </div>
324
+ </div>
325
+
326
+
327
+ <div class="modal fade" id="searchResults">
328
+ <div class="modal-dialog">
329
+ <div class="modal-content">
330
+ <div class="modal-header">
331
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
332
+ <h4 class="modal-title">Search results</h4>
333
+ </div>
334
+ <div class="modal-body"></div>
335
+ <div class="modal-footer">
336
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
337
+ </div>
338
+ </div><!-- /.modal-content -->
339
+ </div><!-- /.modal-dialog -->
340
+ </div>
341
+
342
+
343
+ <footer>
344
+
345
+
346
+ <span class="copyright">
347
+ Copyright 2015-Present <a href="https://github.com/Itee">Itee</a> (Tristan Valcke)
348
+ </span>
349
+
350
+ <span class="jsdoc-message">
351
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a>
352
+
353
+ using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
354
+ </span>
355
+ </footer>
356
+
357
+ <script src="scripts/docstrap.lib.js"></script>
358
+ <script src="scripts/toc.js"></script>
359
+
360
+ <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
361
+
362
+
363
+ <script>
364
+ $( function () {
365
+ $( "[id*='$']" ).each( function () {
366
+ var $this = $( this );
367
+
368
+ $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
369
+ } );
370
+
371
+ $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
372
+ var $this = $( this );
373
+
374
+ var example = $this.find( "code" );
375
+ exampleText = example.html();
376
+ var lang = /{@lang (.*?)}/.exec( exampleText );
377
+ if ( lang && lang[1] ) {
378
+ exampleText = exampleText.replace( lang[0], "" );
379
+ example.html( exampleText );
380
+ lang = lang[1];
381
+ } else {
382
+ var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
383
+ lang = langClassMatch ? langClassMatch[1] : "javascript";
384
+ }
385
+
386
+ if ( lang ) {
387
+
388
+ $this
389
+ .addClass( "sunlight-highlight-" + lang )
390
+ .addClass( "linenums" )
391
+ .html( example.html() );
392
+
393
+ }
394
+ } );
395
+
396
+ Sunlight.highlightAll( {
397
+ lineNumbers : true,
398
+ showMenu : true,
399
+ enableDoclinks : true
400
+ } );
401
+
402
+ $.catchAnchorLinks( {
403
+ navbarOffset: 10
404
+ } );
405
+ $( "#toc" ).toc( {
406
+ anchorName : function ( i, heading, prefix ) {
407
+ return $( heading ).attr( "id" ) || ( prefix + i );
408
+ },
409
+ selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
410
+ showAndHide : false,
411
+ smoothScrolling: true
412
+ } );
413
+
414
+ $( "#main span[id^='toc']" ).addClass( "toc-shim" );
415
+ $( '.dropdown-toggle' ).dropdown();
416
+
417
+ $( "table" ).each( function () {
418
+ var $this = $( this );
419
+ $this.addClass('table');
420
+ } );
421
+
422
+ } );
423
+ </script>
424
+
425
+
426
+
427
+ <!--Navigation and Symbol Display-->
428
+
429
+
430
+ <!--Google Analytics-->
431
+
432
+
433
+
434
+ <script type="text/javascript">
435
+ $(document).ready(function() {
436
+ SearcherDisplay.init();
437
+ });
438
+ </script>
439
+
440
+
441
+ </body>
442
+ </html>
@@ -0,0 +1,249 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width">
7
+ <title>@itee/tasks v1.1.1 Source: tests/benchmarks/run-benchmarks-for-backend.task.mjs</title>
8
+
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/sunlight.dark.css">
13
+
14
+ <link type="text/css" rel="stylesheet" href="styles/site.cyborg.css">
15
+
16
+ </head>
17
+
18
+ <body>
19
+
20
+ <div class="navbar navbar-default navbar-fixed-top ">
21
+ <div class="container">
22
+ <div class="navbar-header">
23
+ <a class="navbar-brand" href="index.html">@itee/tasks v1.1.1</a>
24
+ <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
25
+ <span class="icon-bar"></span>
26
+ <span class="icon-bar"></span>
27
+ <span class="icon-bar"></span>
28
+ </button>
29
+ </div>
30
+ <div class="navbar-collapse collapse" id="topNavigation">
31
+ <ul class="nav navbar-nav">
32
+
33
+ <li class="dropdown">
34
+ <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
35
+ <ul class="dropdown-menu inline">
36
+ <li><a href="global.html#checkBundlingFromEsmFilesDirectTask">checkBundlingFromEsmFilesDirectTask</a></li><li><a href="global.html#checkBundlingTask">checkBundlingTask</a></li><li><a href="global.html#computeBenchmarksTask">computeBenchmarksTask</a></li><li><a href="global.html#computeUnitTestsTask">computeUnitTestsTask</a></li><li><a href="global.html#createRollupConfigs">createRollupConfigs</a></li><li><a href="global.html#npmrunclean">npm run clean</a></li><li><a href="global.html#npmrunhelpdefault">npm run help ( default )</a></li><li><a href="global.html#npmrunlint">npm run lint</a></li><li><a href="global.html#npmrunpatch">npm run patch</a></li><li><a href="global.html#npmrunrelease">npm run release</a></li><li><a href="global.html#npmruntest">npm run test</a></li><li><a href="global.html#runBenchmarksForBackendTask">runBenchmarksForBackendTask</a></li><li><a href="global.html#runBenchmarksForFrontendTask">runBenchmarksForFrontendTask</a></li><li><a href="global.html#runUnitTestsForBackendTask">runUnitTestsForBackendTask</a></li><li><a href="global.html#runUnitTestsForFrontendTask">runUnitTestsForFrontendTask</a></li>
37
+ </ul>
38
+ </li>
39
+
40
+ </ul>
41
+
42
+ <div class="col-sm-3 col-md-3">
43
+ <form class="navbar-form" role="search">
44
+ <div class="input-group">
45
+ <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
46
+ <div class="input-group-btn">
47
+ <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
48
+ </div>
49
+ </div>
50
+ </form>
51
+ </div>
52
+
53
+ </div>
54
+
55
+ </div>
56
+ </div>
57
+
58
+
59
+ <div class="container" id="toc-content">
60
+ <div class="row">
61
+
62
+
63
+ <div class="col-md-12">
64
+
65
+ <div id="main">
66
+
67
+
68
+ <h1 class="page-title">Source: tests/benchmarks/run-benchmarks-for-backend.task.mjs</h1>
69
+
70
+ <section>
71
+ <article>
72
+ <pre
73
+ class="sunlight-highlight-javascript linenums">import colors from 'ansi-colors'
74
+ import log from 'fancy-log'
75
+ import { existsSync } from 'fs'
76
+ import { basename } from 'node:path'
77
+ import { join } from 'path'
78
+ import {
79
+ logLoadingTask,
80
+ packageName,
81
+ packageTestsBenchmarksDirectory
82
+ } from '../../_utils.mjs'
83
+
84
+ logLoadingTask( import.meta.filename )
85
+
86
+ const {
87
+ red,
88
+ yellow
89
+ } = colors
90
+
91
+ /**
92
+ * @description Will run benchmarks with node
93
+ */
94
+ const runBenchmarksForBackendTask = async ( done ) => {
95
+
96
+ const benchesPath = join( packageTestsBenchmarksDirectory, `/${ packageName }.benchmarks.js` )
97
+ if ( !existsSync( benchesPath ) ) {
98
+ log( yellow( `${ benchesPath } does not exist, skip backend benchmarks...` ) )
99
+ done()
100
+ return
101
+ }
102
+
103
+ try {
104
+ await import(benchesPath)
105
+ done()
106
+ } catch ( error ) {
107
+ done( red( error ) )
108
+ }
109
+
110
+ }
111
+ runBenchmarksForBackendTask.displayName = basename( import.meta.filename, '.task.mjs' )
112
+ runBenchmarksForBackendTask.description = 'Will run benchmarks with node'
113
+ runBenchmarksForBackendTask.flags = null
114
+
115
+ export { runBenchmarksForBackendTask }</pre>
116
+ </article>
117
+ </section>
118
+
119
+
120
+
121
+
122
+
123
+ </div>
124
+ </div>
125
+
126
+ <div class="clearfix"></div>
127
+
128
+
129
+
130
+ </div>
131
+ </div>
132
+
133
+
134
+ <div class="modal fade" id="searchResults">
135
+ <div class="modal-dialog">
136
+ <div class="modal-content">
137
+ <div class="modal-header">
138
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
139
+ <h4 class="modal-title">Search results</h4>
140
+ </div>
141
+ <div class="modal-body"></div>
142
+ <div class="modal-footer">
143
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
144
+ </div>
145
+ </div><!-- /.modal-content -->
146
+ </div><!-- /.modal-dialog -->
147
+ </div>
148
+
149
+
150
+ <footer>
151
+
152
+
153
+ <span class="copyright">
154
+ Copyright 2015-Present <a href="https://github.com/Itee">Itee</a> (Tristan Valcke)
155
+ </span>
156
+
157
+ <span class="jsdoc-message">
158
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a>
159
+
160
+ using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
161
+ </span>
162
+ </footer>
163
+
164
+ <script src="scripts/docstrap.lib.js"></script>
165
+ <script src="scripts/toc.js"></script>
166
+
167
+ <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
168
+
169
+
170
+ <script>
171
+ $( function () {
172
+ $( "[id*='$']" ).each( function () {
173
+ var $this = $( this );
174
+
175
+ $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
176
+ } );
177
+
178
+ $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
179
+ var $this = $( this );
180
+
181
+ var example = $this.find( "code" );
182
+ exampleText = example.html();
183
+ var lang = /{@lang (.*?)}/.exec( exampleText );
184
+ if ( lang && lang[1] ) {
185
+ exampleText = exampleText.replace( lang[0], "" );
186
+ example.html( exampleText );
187
+ lang = lang[1];
188
+ } else {
189
+ var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
190
+ lang = langClassMatch ? langClassMatch[1] : "javascript";
191
+ }
192
+
193
+ if ( lang ) {
194
+
195
+ $this
196
+ .addClass( "sunlight-highlight-" + lang )
197
+ .addClass( "linenums" )
198
+ .html( example.html() );
199
+
200
+ }
201
+ } );
202
+
203
+ Sunlight.highlightAll( {
204
+ lineNumbers : true,
205
+ showMenu : true,
206
+ enableDoclinks : true
207
+ } );
208
+
209
+ $.catchAnchorLinks( {
210
+ navbarOffset: 10
211
+ } );
212
+ $( "#toc" ).toc( {
213
+ anchorName : function ( i, heading, prefix ) {
214
+ return $( heading ).attr( "id" ) || ( prefix + i );
215
+ },
216
+ selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
217
+ showAndHide : false,
218
+ smoothScrolling: true
219
+ } );
220
+
221
+ $( "#main span[id^='toc']" ).addClass( "toc-shim" );
222
+ $( '.dropdown-toggle' ).dropdown();
223
+
224
+ $( "table" ).each( function () {
225
+ var $this = $( this );
226
+ $this.addClass('table');
227
+ } );
228
+
229
+ } );
230
+ </script>
231
+
232
+
233
+
234
+ <!--Navigation and Symbol Display-->
235
+
236
+
237
+ <!--Google Analytics-->
238
+
239
+
240
+
241
+ <script type="text/javascript">
242
+ $(document).ready(function() {
243
+ SearcherDisplay.init();
244
+ });
245
+ </script>
246
+
247
+
248
+ </body>
249
+ </html>