js-build-tools 6.0.0 → 6.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 (67) hide show
  1. package/README.md +134 -27
  2. package/dist/build.js +9 -3
  3. package/dist/build.min.js +1 -1
  4. package/dist/bundle.js +4 -3
  5. package/dist/bundle.min.js +1 -1
  6. package/dist/bundleMinify.js +2 -1
  7. package/dist/bundleMinify.min.js +1 -1
  8. package/dist/copyFiles.js +47 -0
  9. package/dist/copyFiles.min.js +1 -0
  10. package/dist/copyFonts.js +2 -1
  11. package/dist/copyFonts.min.js +1 -1
  12. package/dist/default.js +2 -1
  13. package/dist/default.min.js +1 -1
  14. package/dist/distMinify.js +2 -1
  15. package/dist/distMinify.min.js +1 -1
  16. package/dist/jsdocDocs.js +15 -0
  17. package/dist/jsdocDocs.min.js +1 -0
  18. package/dist/partials/addToReadme.js +3 -2
  19. package/dist/partials/beginWatcher.js +2 -1
  20. package/dist/partials/clean.js +2 -1
  21. package/dist/partials/copyFor.js +10 -2
  22. package/dist/partials/distFor.js +2 -1
  23. package/dist/partials/distForSrc.js +2 -1
  24. package/dist/partials/distSeries.js +2 -1
  25. package/dist/partials/imagesFor.js +2 -1
  26. package/dist/partials/jsdocDocsFor.js +155 -0
  27. package/dist/partials/neostandardLint.js +31 -12
  28. package/dist/partials/readmeTemplate.js +2 -1
  29. package/dist/partials/runOnChange.js +2 -1
  30. package/dist/partials/sassFor.js +2 -1
  31. package/dist/partials/tsFor.js +2 -1
  32. package/dist/partials/typeDocsFor.js +2 -1
  33. package/dist/sourceLint.js +4 -2
  34. package/dist/sourceLint.min.js +1 -1
  35. package/dist/test-helpers/neostandardLintWithRealNeostandard.js +5 -3
  36. package/dist/test-helpers/setUp.js +2 -1
  37. package/dist/testFull.js +2 -1
  38. package/dist/testFull.min.js +1 -1
  39. package/dist/testHelpers.js +2 -1
  40. package/dist/testHelpers.min.js +1 -1
  41. package/dist/testQuick.js +2 -1
  42. package/dist/testQuick.min.js +1 -1
  43. package/dist/utilities/dotNotate.js +3 -1
  44. package/dist/utilities/getBundleConfigs.js +3 -2
  45. package/dist/watchTest.js +2 -1
  46. package/dist/watchTest.min.js +1 -1
  47. package/functions/build.mjs +7 -2
  48. package/functions/build.test.mjs +50 -1
  49. package/functions/bundle.mjs +2 -2
  50. package/functions/copyFiles.mjs +32 -0
  51. package/functions/copyFiles.test.mjs +78 -0
  52. package/functions/jsdocDocs.mjs +10 -0
  53. package/functions/partials/addToReadme.mjs +1 -1
  54. package/functions/partials/copyFor.mjs +4 -1
  55. package/functions/partials/jsdocDocsFor.mjs +132 -0
  56. package/functions/partials/jsdocDocsFor.test.mjs +101 -0
  57. package/functions/partials/neostandardLint.mjs +19 -7
  58. package/functions/partials/neostandardLint.test.mjs +9 -1
  59. package/functions/sourceLint.mjs +1 -1
  60. package/functions/sourceLint.test.mjs +24 -0
  61. package/functions/test-helpers/neostandardLintWithRealNeostandard.mjs +7 -5
  62. package/functions/utilities/dotNotate.mjs +3 -1
  63. package/functions/utilities/dotNotate.test.mjs +34 -0
  64. package/functions/utilities/getBundleConfigs.mjs +1 -1
  65. package/gulp.config.mjs +42 -5
  66. package/gulpfile.base.mjs +2 -0
  67. package/package.json +11 -1
package/README.md CHANGED
@@ -11,7 +11,9 @@ Using this tool suite, you can:
11
11
  * Bundle your distribution files to be used in a browser environment.
12
12
  * Run tests and watch for changes.
13
13
  * Generate jsdoc readme files.
14
- * Generate HTML documentation straight from your TypeScript source (with TypeDoc), with a module for each of your folders.
14
+ * Generate real HTML documentation straight from your source - TypeDoc for a TypeScript project (a module for
15
+ each of your folders), or jsdoc with a modern theme for a plain JavaScript one.
16
+ * Copy files (a bundle, or anything else) to another location, on demand.
15
17
 
16
18
  ## Installation
17
19
 
@@ -242,9 +244,14 @@ Update the test config as follows:
242
244
  "readme": {
243
245
  "template": "MAIN.md",
244
246
  "options": "utf8",
245
- "toFile": "README.md",
247
+ "file": "README.md",
246
248
  "from": [
247
- // Use the dist directory files to generate the jsdocs
249
+ // Use the dist directory files to generate the jsdocs - dist is always .js regardless of source
250
+ // extension, since Babel compiles .mjs source down to it, so this is enough on its own. If you instead
251
+ // have a handful of standalone .mjs files that never go through the normal dist compile (for example a
252
+ // config file read directly by the build itself), see 'Configure including ESM files in the generated
253
+ // readme' for readme.fromEsm instead - a lighter option than switching your whole project's dist/test
254
+ // config over to .mjs just to document a few files.
248
255
  "dist/!(*.test).js"
249
256
  ],
250
257
  "to": "./"
@@ -276,10 +283,12 @@ module.exports = {
276
283
  }
277
284
  ```
278
285
 
279
- ### Configure HTML JS Documentation (optional)
286
+ ### Configure HTML JS Documentation, full manual control (optional, advanced)
280
287
 
281
- It may be desirable to generate HTML documentation for your JS files.
282
- (For a TypeScript project, see 'Configure TypeScript documentation' instead.)
288
+ For most projects, `docs.enabled` with `docs.method: 'jsdoc'` (see 'Configure HTML documentation' below) is the
289
+ simpler path - no `.jsdoc.conf.js` file to maintain by hand, wired straight into `gulp build`/`gulp docs`. This
290
+ section is for when you want full, direct control over jsdoc's own config instead (a plugin or option this
291
+ project's own generated config does not expose, for example).
283
292
 
284
293
  Create a `.jsdoc.conf.js` file and add the following:
285
294
 
@@ -371,6 +380,33 @@ exports if you want it documented this cleanly:
371
380
  }
372
381
  ```
373
382
 
383
+ ### Configure copy files (optional)
384
+
385
+ Copy files (a bundle, or anything else) to another location - any number of entries, each independent. Unlike
386
+ every other task here, this is never run automatically as part of `gulp build` - what this copies is often the
387
+ live, publicly-reachable version of something, so publishing it should be a deliberate step your own script
388
+ opts into, not a side effect of a routine local build.
389
+
390
+ Add the following to the exports in your `build-tools.config.json`:
391
+
392
+ ```json
393
+ {
394
+ "copyFiles": [
395
+ {
396
+ // The glob pattern(s) of files to copy
397
+ "from": "browser/**/*.js",
398
+ // The directory to copy them into
399
+ "to": "../my-other-project/vendor",
400
+ // Optional - preserves this glob's own subdirectory structure in the destination, instead of flattening it
401
+ "base": "browser"
402
+ }
403
+ ]
404
+ }
405
+ ```
406
+
407
+ If you also export `copyFiles` from your gulpfile you can run it on its own with `gulp copyFiles`, and can then
408
+ add your own script for it, for example `"publish:bundle": "gulp copyFiles"`.
409
+
374
410
  ### Configure move fonts (optional)
375
411
 
376
412
  Be able to copy a source directory of fonts into the distribution path.
@@ -493,32 +529,46 @@ babelConfig.presets.push('@babel/preset-typescript')
493
529
  module.exports = babelConfig
494
530
  ```
495
531
 
496
- ### Configure TypeScript documentation (optional)
497
-
498
- `jsdoc-to-markdown` only reads `.js` files, so the types in your `.ts` files (and the comments on them) do not reach
499
- the readme it generates. Instead, this can generate HTML documentation straight from the TypeScript source with
500
- [TypeDoc](https://typedoc.org/). Every folder in your source directory becomes a module of the documentation, the default
501
- export of each file (one function per file) is listed under the name of the file, and everything else a file exports (for
502
- example the types in a `types.ts`) is listed as it is. Index files, tests and declaration files are left out. A file
503
- which sits directly in the source directory, beside the folders, is a module of its own (unless it is `index` or
504
- `main`). The first comment of a folder's `index.ts` (or the header comment of such a file) describes its module. The
505
- comments on your code are the documentation, and the types come from the code itself, so `@module`, `@memberOf`,
506
- `@typedef` and the `{Type}` of `@param` are not needed.
507
-
508
- `typedoc` is an optional peer dependency (like `typescript`), install it in your project with
509
- `npm install --save-dev typedoc` (this needs a `typescript` version it supports).
532
+ ### Configure HTML documentation (optional)
533
+
534
+ `jsdoc-to-markdown` (the readme generator) only reads `.js` files, so the types in your `.ts` files (and the
535
+ comments on them) never reach the readme it generates, and even for a plain JavaScript project a single
536
+ markdown readme is a thinner result than a real browsable site. Instead, `docs.enabled` generates real HTML
537
+ documentation straight from your source, with either engine:
538
+
539
+ * **TypeDoc** (for a TypeScript project) - every folder in your source directory becomes a module of the
540
+ documentation, the default export of each file (one function per file) is listed under the name of the file,
541
+ and everything else a file exports (for example the types in a `types.ts`) is listed as it is. Index files,
542
+ tests and declaration files are left out. A file which sits directly in the source directory, beside the
543
+ folders, is a module of its own (unless it is `index` or `main`). The first comment of a folder's `index.ts`
544
+ (or the header comment of such a file) describes its module. The comments on your code are the documentation,
545
+ and the types come from the code itself, so `@module`, `@memberOf`, `@typedef` and the `{Type}` of `@param`
546
+ are not needed. `typedoc` is an optional peer dependency (like `typescript`), install it in your project with
547
+ `npm install --save-dev typedoc` (this needs a `typescript` version it supports).
548
+ * **jsdoc** (for a plain JavaScript project, where TypeDoc has no real types to read) - scans your source
549
+ recursively with jsdoc itself, rendered with a modern theme (`clean-jsdoc-theme` by default, used instead of
550
+ jsdoc's own classic default template) instead of the manual `.jsdoc.conf.js` setup described further below.
551
+ `jsdoc` and whichever theme you configure are optional peer dependencies, install them with
552
+ `npm install --save-dev jsdoc clean-jsdoc-theme` (or your own chosen theme package).
510
553
 
511
554
  Add the following to the exports in your `build-tools.config.json`:
512
555
 
513
556
  ```json
514
557
  {
515
558
  "docs": {
516
- // Generate the documentation from the TypeScript source
559
+ // Generate the documentation from the source
517
560
  "enabled": true,
518
- // The directory holding the TypeScript source, each folder in it becomes a module
561
+ // The directory holding the source, each folder in it becomes a module (TypeDoc) or is scanned recursively (jsdoc)
519
562
  "from": "src",
520
563
  // The markdown file used as the front page of the documentation (a short overview of your project)
521
564
  "index": "MAIN.md",
565
+ // 'typedoc' or 'jsdoc'. Left out (or false), it's inferred from typescript.enabled - 'typedoc' when your
566
+ // project is TypeScript, 'jsdoc' when it is not - so most projects never need to set this at all. Set it
567
+ // explicitly to override that inference either way.
568
+ "method": false,
569
+ // Only meaningful when method is (or resolves to) 'jsdoc' - the theme package to render with. TypeDoc
570
+ // always keeps its own default regardless of this setting.
571
+ "theme": "clean-jsdoc-theme",
522
572
  // Where the HTML is generated (the directory is cleared first)
523
573
  "to": "docs"
524
574
  }
@@ -529,6 +579,30 @@ While `docs.enabled` is on, `gulp build` generates the documentation instead of
529
579
  hand-written (a short overview which links to the documentation). If you also export `docs` from your gulpfile you can
530
580
  run it on its own with `gulp docs`, and can then add the script `"docs": "gulp docs"`.
531
581
 
582
+ ### Configure lint rule overrides (optional)
583
+
584
+ `sourceLint` lints your real source directly (not the compiled dist/browser output) with
585
+ [neostandard](https://github.com/neostandard/neostandard). Occasionally a rule is wrong for your project
586
+ specifically, rather than something to fix in your code - for example a test which deliberately contains a string
587
+ of literal `${...}` text (simulating another module's real source, not a mistaken non-template string), which
588
+ trips neostandard's `no-template-curly-in-string` rule as a false positive. `lint.rules` layers ESLint rule
589
+ overrides on top of neostandard's own rules, scoped to the same files neostandard itself lints:
590
+
591
+ ```json
592
+ {
593
+ "lint": {
594
+ // ESLint rule overrides, keyed and valued exactly as ESLint's own "rules" object.
595
+ "rules": {
596
+ "no-template-curly-in-string": "off"
597
+ }
598
+ }
599
+ }
600
+ ```
601
+
602
+ Empty by default, so a project that never sets this gets exactly neostandard's own rules, unchanged. Prefer fixing
603
+ the actual code (or, for one specific line, an `eslint-disable-next-line` comment) over this when the finding is
604
+ real - reach for `lint.rules` only when the rule itself doesn't fit your project.
605
+
532
606
  ### Configure Scripts
533
607
 
534
608
  In your `package.json` file, add the following scripts:
@@ -540,6 +614,7 @@ In your `package.json` file, add the following scripts:
540
614
  "dev": "gulp",
541
615
  "docs": "gulp docs",
542
616
  "htmldocs": "jsdoc -R MAIN.md -c ./.jsdoc.conf.js -d docs",
617
+ "publish:bundle": "gulp copyFiles",
543
618
  "readme": "gulp readme",
544
619
  "sass": "gulp sass",
545
620
  "test": "gulp testFull",
@@ -600,11 +675,13 @@ Modify these configurations to match your project specifications.
600
675
  * [~JestTestFlags](#module_gulpConfig..JestTestFlags) : <code>FlagsSetting</code>
601
676
  * [~StringSetting](#module_gulpConfig..StringSetting) : <code>string</code>
602
677
  * [~Setting](#module_gulpConfig..Setting) : <code>ArrayableSetting</code> \| <code>BooleanSetting</code> \| <code>FlagsSetting</code> \| <code>StringSetting</code>
678
+ * [~CopyFilesEntry](#module_gulpConfig..CopyFilesEntry) : <code>Object</code>
603
679
  * [~BrowserConfig](#module_gulpConfig..BrowserConfig) : <code>Object.&lt;string, Setting&gt;</code>
604
680
  * [~AdditionalBundleConfig](#module_gulpConfig..AdditionalBundleConfig) : <code>Object.&lt;string, Setting&gt;</code>
605
681
  * [~DistConfig](#module_gulpConfig..DistConfig) : <code>Object.&lt;string, Setting&gt;</code>
606
682
  * [~FontConfig](#module_gulpConfig..FontConfig) : <code>Object.&lt;string, Setting&gt;</code>
607
683
  * [~ImageConfig](#module_gulpConfig..ImageConfig) : <code>Object.&lt;string, Setting&gt;</code>
684
+ * [~LintConfig](#module_gulpConfig..LintConfig) : <code>Object.&lt;string, Setting&gt;</code>
608
685
  * [~ReadmeConfig](#module_gulpConfig..ReadmeConfig) : <code>Object.&lt;string, Setting&gt;</code>
609
686
  * [~DocsConfig](#module_gulpConfig..DocsConfig) : <code>Object.&lt;string, Setting&gt;</code>
610
687
  * [~SassConfig](#module_gulpConfig..SassConfig) : <code>Object.&lt;string, Setting&gt;</code>
@@ -692,6 +769,20 @@ A setting that may only be a string.
692
769
  Any single configuration option is a Setting.
693
770
 
694
771
  **Kind**: inner typedef of [<code>gulpConfig</code>](#module_gulpConfig)
772
+ <a name="module_gulpConfig..CopyFilesEntry"></a>
773
+
774
+ ### gulpConfig~CopyFilesEntry : <code>Object</code>
775
+ One copy-files entry: a glob (or array of globs) to copy, and where to copy it.
776
+
777
+ **Kind**: inner typedef of [<code>gulpConfig</code>](#module_gulpConfig)
778
+ **Properties**
779
+
780
+ | Name | Type | Description |
781
+ | --- | --- | --- |
782
+ | from | <code>ArrayableSetting</code> | The glob pattern(s) of files to copy. |
783
+ | to | <code>StringSetting</code> | The directory to copy them into. |
784
+ | base | <code>FlagStringSetting</code> | Optional base for gulp's own src(pattern, {base}), to preserve a glob's own subdirectory structure in the destination instead of flattening it. false (the default) uses gulp's own default base behaviour. |
785
+
695
786
  <a name="module_gulpConfig..BrowserConfig"></a>
696
787
 
697
788
  ### gulpConfig~BrowserConfig : <code>Object.&lt;string, Setting&gt;</code>
@@ -767,6 +858,18 @@ Configurations to minify and copy the images.
767
858
  | from | <code>StringSetting</code> | Path to search for images. |
768
859
  | to | <code>StringSetting</code> | Path to output images. |
769
860
 
861
+ <a name="module_gulpConfig..LintConfig"></a>
862
+
863
+ ### gulpConfig~LintConfig : <code>Object.&lt;string, Setting&gt;</code>
864
+ Configurations for linting (see [module:partials.neostandardLint](module:partials.neostandardLint)).
865
+
866
+ **Kind**: inner typedef of [<code>gulpConfig</code>](#module_gulpConfig)
867
+ **Properties**
868
+
869
+ | Name | Type | Description |
870
+ | --- | --- | --- |
871
+ | rules | <code>Object.&lt;string, \*&gt;</code> | ESLint rule overrides layered on top of neostandard's own config, scoped to the same files neostandard itself lints. For a rule that is wrong for your project specifically (for example a test fixture that deliberately contains text neostandard mistakes for a real syntax problem), rather than something to fix in your code. Empty by default: a project that never sets this gets exactly neostandard's own rules, unchanged. Keyed and valued exactly as ESLint's own `rules` object - see https://eslint.org/docs/latest/use/configure/rules. |
872
+
770
873
  <a name="module_gulpConfig..ReadmeConfig"></a>
771
874
 
772
875
  ### gulpConfig~ReadmeConfig : <code>Object.&lt;string, Setting&gt;</code>
@@ -787,20 +890,22 @@ Configurations to compile and generate the Readme file.
787
890
  <a name="module_gulpConfig..DocsConfig"></a>
788
891
 
789
892
  ### gulpConfig~DocsConfig : <code>Object.&lt;string, Setting&gt;</code>
790
- Configurations for generating the HTML documentation of a TypeScript project (with TypeDoc, from the source).
893
+ Configurations for generating the HTML documentation of a project's own source, with either TypeDoc (real
791
894
 
792
895
  **Kind**: inner typedef of [<code>gulpConfig</code>](#module_gulpConfig)
793
896
  **Properties**
794
897
 
795
898
  | Name | Type | Description |
796
899
  | --- | --- | --- |
797
- | enabled | <code>BooleanSetting</code> | Toggle generating the documentation from the TypeScript source. When it is on the build does this instead of generating the readme from the jsdoc comments of the compiled files. |
798
- | from | <code>StringSetting</code> | The directory holding the TypeScript source, each folder in it becomes a module. |
900
+ | enabled | <code>BooleanSetting</code> | Toggle generating the documentation from the source. When it is on the build does this instead of generating the readme from the jsdoc comments of the compiled files. |
901
+ | from | <code>StringSetting</code> | The directory holding the source, each folder in it becomes a module (TypeDoc) or is scanned recursively (jsdoc). |
799
902
  | index | <code>StringSetting</code> | The markdown file used as the front page of the documentation. |
800
- | logLevel | <code>StringSetting</code> | How much TypeDoc reports: Verbose, Info, Warn, Error or None. |
903
+ | logLevel | <code>StringSetting</code> | How much TypeDoc reports: Verbose, Info, Warn, Error or None. Not used by jsdoc. |
904
+ | method | <code>FlagStringSetting</code> | 'typedoc' or 'jsdoc'. False (the default) infers it from typescript.enabled - 'typedoc' when on, 'jsdoc' when off - so an existing TypeScript project's config needs no change to keep working exactly as it already does; set this explicitly to override that inference either way. |
905
+ | theme | <code>StringSetting</code> | The jsdoc theme package to use (only meaningful when method is 'jsdoc' - TypeDoc keeps its own default regardless). Defaults to 'clean-jsdoc-theme'. |
801
906
  | title | <code>StringSetting</code> | The name of the documentation, defaults to the name in the package.json. |
802
907
  | to | <code>StringSetting</code> | The directory to generate the documentation in (it is cleared first). |
803
- | tsconfig | <code>FlagStringSetting</code> | The tsconfig file to read the source with, defaults to the one of typescript.config. |
908
+ | tsconfig | <code>FlagStringSetting</code> | The tsconfig file to read the source with (TypeDoc only), defaults to the one of typescript.config. |
804
909
 
805
910
  <a name="module_gulpConfig..SassConfig"></a>
806
911
 
@@ -858,10 +963,12 @@ A set of Configurations options defined by Settings.
858
963
  | --- | --- | --- |
859
964
  | browser | <code>BrowserConfig</code> | Browser bundling configuration group. |
860
965
  | cleanPaths | <code>ArrayableSetting</code> | The paths for directories to delete before build. |
966
+ | copyFiles | <code>Array.&lt;CopyFilesEntry&gt;</code> | Files to copy elsewhere, run via the copyFiles task - never automatically as part of build, since what this copies is often the live, publicly-reachable version of something (e.g. a bundle), and publishing it should be a deliberate step. |
861
967
  | dist | <code>DistConfig</code> | Distribution file generation configuration group. |
862
968
  | docs | <code>DocsConfig</code> | Generate the documentation of a TypeScript project configuration group. |
863
969
  | fonts | <code>FontConfig</code> | Fonts copy configuration group. |
864
970
  | images | <code>ImageConfig</code> | Minify and copy the images configuration. |
971
+ | lint | <code>LintConfig</code> | Linting configuration group. |
865
972
  | readme | <code>ReadmeConfig</code> | Build readme files configuration. |
866
973
  | rootPath | <code>StringSetting</code> | Base directory of the project. |
867
974
  | sass | <code>SassConfig</code> | Compile CSS from SASS configuration. |
package/dist/build.js CHANGED
@@ -10,6 +10,7 @@ var _bundleMinify = require("./bundleMinify.js");
10
10
  var _partials = require("./partials.js");
11
11
  var _compileReadme = require("./compileReadme.js");
12
12
  var _typeDocs = require("./typeDocs.js");
13
+ var _jsdocDocs = require("./jsdocDocs.js");
13
14
  var _distMinify = require("./distMinify.js");
14
15
  var _sourceLint = require("./sourceLint.js");
15
16
  var _gulp = require("gulp");
@@ -18,7 +19,8 @@ var _copyFonts = require("./copyFonts.js");
18
19
  var _images = require("./images.js");
19
20
  var _sass = require("./sass.js");
20
21
  var _testFull = require("./testFull.js");
21
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
22
+ var cache;
23
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
22
24
  /**
23
25
  * Runs several processes to build and validate the project.
24
26
  * Cleans and lints the source, distributes and minifies, bundles and minifies, creates the readme, then runs the
@@ -29,9 +31,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
29
31
  const build = (done = null) => {
30
32
  const buildActions = [(0, _partials.distSeries)(), _distMinify.distMinify];
31
33
  const generateDocs = gulpConfig.get('docs.enabled');
34
+ // docs.method picks the engine explicitly; left unset (false, the default), it's inferred from
35
+ // typescript.enabled - every existing TypeScript project's config, which never sets method, keeps producing
36
+ // TypeDoc output exactly as it always has.
37
+ const docsMethod = gulpConfig.get('docs.method') || (gulpConfig.get('typescript.enabled') ? 'typedoc' : 'jsdoc');
32
38
  if (generateDocs) {
33
- // The documentation is generated from the TypeScript source itself, the readme is written by hand
34
- buildActions.push(_typeDocs.typeDocs);
39
+ // The documentation is generated from the source itself, the readme is written by hand
40
+ buildActions.push(docsMethod === 'jsdoc' ? _jsdocDocs.jsdocDocs : _typeDocs.typeDocs);
35
41
  } else if (gulpConfig.get('typescript.enabled')) {
36
42
  // For ts usage, we need to run the readme on the dist directly since that is where the .js files are located
37
43
  buildActions.push(_compileReadme.compileReadme);
package/dist/build.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=void 0;var _bundle=require("./bundle.js"),_bundleMinify=require("./bundleMinify.js"),_partials=require("./partials.js"),_compileReadme=require("./compileReadme.js"),_typeDocs=require("./typeDocs.js"),_distMinify=require("./distMinify.js"),_sourceLint=require("./sourceLint.js"),_gulp=require("gulp"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_copyFonts=require("./copyFonts.js"),_images=require("./images.js"),_sass=require("./sass.js"),_testFull=require("./testFull.js");function _interopRequireWildcard(e,i){if("function"==typeof WeakMap)var s=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,i){if(!i&&e&&e.__esModule)return e;var t,u,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(t=i?r:s){if(t.has(e))return t.get(e);t.set(e,l)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((u=(t=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(u.get||u.set)?t(l,i,u):l[i]=e[i]);return l})(e,i)}const build=(e=null)=>{const i=[(0,_partials.distSeries)(),_distMinify.distMinify],s=gulpConfig.get("docs.enabled");s?i.push(_typeDocs.typeDocs):gulpConfig.get("typescript.enabled")&&i.push(_compileReadme.compileReadme),gulpConfig.get("browser.enabled")&&(i.push(_bundle.bundle),i.push(_bundleMinify.bundleMinify));const r=[(0,_gulp.series)(...i)];return s||gulpConfig.get("typescript.enabled")||r.push(_compileReadme.compileReadme),r.push(_testFull.testFull),gulpConfig.get("fonts.enabled")&&r.push(_copyFonts.copyFonts),gulpConfig.get("images.enabled")&&r.push(_images.images),gulpConfig.get("sass.enabled")&&r.push(_sass.sass),(0,_gulp.series)((0,_gulp.parallel)(_partials.clean,_sourceLint.sourceLint),(0,_gulp.parallel)(...r))(e)};exports.build=build;
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=void 0;var cache,_bundle=require("./bundle.js"),_bundleMinify=require("./bundleMinify.js"),_partials=require("./partials.js"),_compileReadme=require("./compileReadme.js"),_typeDocs=require("./typeDocs.js"),_jsdocDocs=require("./jsdocDocs.js"),_distMinify=require("./distMinify.js"),_sourceLint=require("./sourceLint.js"),_gulp=require("gulp"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_copyFonts=require("./copyFonts.js"),_images=require("./images.js"),_sass=require("./sass.js"),_testFull=require("./testFull.js");function _interopRequireWildcard(e,s){if(!s&&e&&e.__esModule)return e;var i,t,r=Object.defineProperty,l={__proto__:null,default:e};if(Object(e)!==e)return l;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,l)}for(t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=r&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?r(l,t,i):l[t]=e[t]);return l}const build=(e=null)=>{const s=[(0,_partials.distSeries)(),_distMinify.distMinify],i=gulpConfig.get("docs.enabled"),t=gulpConfig.get("docs.method")||(gulpConfig.get("typescript.enabled")?"typedoc":"jsdoc");i?s.push("jsdoc"===t?_jsdocDocs.jsdocDocs:_typeDocs.typeDocs):gulpConfig.get("typescript.enabled")&&s.push(_compileReadme.compileReadme),gulpConfig.get("browser.enabled")&&(s.push(_bundle.bundle),s.push(_bundleMinify.bundleMinify));const r=[(0,_gulp.series)(...s)];return i||gulpConfig.get("typescript.enabled")||r.push(_compileReadme.compileReadme),r.push(_testFull.testFull),gulpConfig.get("fonts.enabled")&&r.push(_copyFonts.copyFonts),gulpConfig.get("images.enabled")&&r.push(_images.images),gulpConfig.get("sass.enabled")&&r.push(_sass.sass),(0,_gulp.series)((0,_gulp.parallel)(_partials.clean,_sourceLint.sourceLint),(0,_gulp.parallel)(...r))(e)};exports.build=build;
package/dist/bundle.js CHANGED
@@ -13,7 +13,8 @@ var _mergeStream = _interopRequireDefault(require("merge-stream"));
13
13
  var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
14
14
  var _vinylSourceStream = _interopRequireDefault(require("vinyl-source-stream"));
15
15
  var _getBundleConfigs = require("./utilities/getBundleConfigs.js");
16
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
+ var cache;
17
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
17
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
19
  /**
19
20
  * Starting at each bundle's own entry point (dist.main for the primary bundle, or its own
@@ -44,10 +45,10 @@ const bundle = () => (0, _mergeStream.default)((0, _getBundleConfigs.getBundleCo
44
45
  const bundler = (0, _browserify.default)(main, {
45
46
  standalone: name
46
47
  });
47
- if (ignore && ignore.length) {
48
+ if (ignore.length) {
48
49
  bundler.ignore(ignore);
49
50
  }
50
- if (exclude && exclude.length) {
51
+ if (exclude.length) {
51
52
  bundler.exclude(exclude);
52
53
  }
53
54
  return bundler.bundle().pipe((0, _vinylSourceStream.default)(`${name}.js`));
@@ -1 +1 @@
1
- "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.bundle=void 0,require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.map.js");var _browserify=_interopRequireDefault(require("browserify")),_gulp=require("gulp"),_mergeStream=_interopRequireDefault(require("merge-stream")),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_vinylSourceStream=_interopRequireDefault(require("vinyl-source-stream")),_getBundleConfigs=require("./utilities/getBundleConfigs.js");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,u=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var n,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(n=r?u:t){if(n.has(e))return n.get(e);n.set(e,o)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(i.get||i.set)?n(o,r,i):o[r]=e[r]);return o})(e,r)}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const bundle=()=>(0,_mergeStream.default)((0,_getBundleConfigs.getBundleConfigs)().map(({name:e,main:r,ignore:t,exclude:u})=>{const n=(0,_browserify.default)(r,{standalone:e});return t&&t.length&&n.ignore(t),u&&u.length&&n.exclude(u),n.bundle().pipe((0,_vinylSourceStream.default)(`${e}.js`))})).pipe((0,_gulp.dest)(gulpConfig.get("browser.to")));exports.bundle=bundle;
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.bundle=void 0,require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.map.js");var cache,_browserify=_interopRequireDefault(require("browserify")),_gulp=require("gulp"),_mergeStream=_interopRequireDefault(require("merge-stream")),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_vinylSourceStream=_interopRequireDefault(require("vinyl-source-stream")),_getBundleConfigs=require("./utilities/getBundleConfigs.js");function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;var t,u,i=Object.defineProperty,n={__proto__:null,default:e};if(Object(e)!==e)return n;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,n)}for(u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((t=i&&Object.getOwnPropertyDescriptor(e,u))&&(t.get||t.set)?i(n,u,t):n[u]=e[u]);return n}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const bundle=()=>(0,_mergeStream.default)((0,_getBundleConfigs.getBundleConfigs)().map(({name:e,main:r,ignore:t,exclude:u})=>{const i=(0,_browserify.default)(r,{standalone:e});return t.length&&i.ignore(t),u.length&&i.exclude(u),i.bundle().pipe((0,_vinylSourceStream.default)(`${e}.js`))})).pipe((0,_gulp.dest)(gulpConfig.get("browser.to")));exports.bundle=bundle;
@@ -10,7 +10,8 @@ require("core-js/modules/esnext.iterator.map.js");
10
10
  var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
11
11
  var _minifyFor = require("./partials/minifyFor.js");
12
12
  var _getBundleConfigs = require("./utilities/getBundleConfigs.js");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ var cache;
14
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
14
15
  /**
15
16
  * Creates the minified file for every bundle (the primary bundle, plus any additional ones from
16
17
  * browser.bundles). The minify step itself never varies per bundle, so this is one shared
@@ -1 +1 @@
1
- "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.bundleMinify=void 0,require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.map.js");var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_minifyFor=require("./partials/minifyFor.js"),_getBundleConfigs=require("./utilities/getBundleConfigs.js");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var i=new WeakMap,t=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var n,o,u={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return u;if(n=r?t:i){if(n.has(e))return n.get(e);n.set(e,u)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(o.get||o.set)?n(u,r,o):u[r]=e[r]);return u})(e,r)}const bundleMinify=()=>(0,_minifyFor.minifyFor)((0,_getBundleConfigs.getBundleConfigs)().map(({name:e})=>`${gulpConfig.get("browser.to")}/${e}.js`),gulpConfig.get("browser.to"));exports.bundleMinify=bundleMinify;
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.bundleMinify=void 0,require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.map.js");var cache,gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_minifyFor=require("./partials/minifyFor.js"),_getBundleConfigs=require("./utilities/getBundleConfigs.js");function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;var i,t,n=Object.defineProperty,o={__proto__:null,default:e};if(Object(e)!==e)return o;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,o)}for(t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=n&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?n(o,t,i):o[t]=e[t]);return o}const bundleMinify=()=>(0,_minifyFor.minifyFor)((0,_getBundleConfigs.getBundleConfigs)().map(({name:e})=>`${gulpConfig.get("browser.to")}/${e}.js`),gulpConfig.get("browser.to"));exports.bundleMinify=bundleMinify;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/esnext.weak-map.delete-all.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.copyFiles = void 0;
8
+ require("core-js/modules/esnext.iterator.constructor.js");
9
+ require("core-js/modules/esnext.iterator.map.js");
10
+ var _copyFor = require("./partials/copyFor.js");
11
+ var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
12
+ var cache;
13
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
14
+ /**
15
+ * Copy files from one place to another - any number of { from, to, base? } entries, configured via copyFiles.
16
+ * A project with no copyFiles entries gets a task that does nothing. Meant to be run explicitly (its own script,
17
+ * e.g. `gulp copyFiles`), not folded into the default build - a bundle (or any other file this copies) is often
18
+ * the live, publicly-reachable version of something, so publishing it elsewhere should be a deliberate step, not
19
+ * a side effect of every routine local build.
20
+ *
21
+ * Reuses copyFor (already shared with copyFonts) rather than a fresh src()/dest() pair - that keeps its existing
22
+ * encoding: false fix (Gulp 5's default utf8 handling corrupts binary files such as fonts or a minified bundle)
23
+ * instead of silently losing it in a parallel implementation.
24
+ *
25
+ * Each entry runs as its own independent copyFor(), awaited via Promise.all rather than merged into one combined
26
+ * stream (mergeStream, the pattern bundle.mjs uses) - that pattern assumes every merged stream ends up at the
27
+ * same shared destination; here, each entry can have a genuinely different one, and merging streams that each
28
+ * already terminate at their own separate dest() hit a real "write after end" error in practice.
29
+ * @memberOf module:js-build-tools
30
+ * @returns {Promise<void>}
31
+ */
32
+ const copyFiles = () => {
33
+ const copies = gulpConfig.get('copyFiles', []);
34
+ if (!copies.length) {
35
+ return Promise.resolve();
36
+ }
37
+ return Promise.all(copies.map(({
38
+ from,
39
+ to,
40
+ base
41
+ }) => new Promise((resolve, reject) => {
42
+ (0, _copyFor.copyFor)(from, to, {
43
+ base
44
+ }).on('finish', resolve).on('error', reject);
45
+ }))).then(() => {});
46
+ };
47
+ exports.copyFiles = copyFiles;
@@ -0,0 +1 @@
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.copyFiles=void 0,require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.map.js");var cache,_copyFor=require("./partials/copyFor.js"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js"));function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;var o,t,c=Object.defineProperty,s={__proto__:null,default:e};if(Object(e)!==e)return s;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,s)}for(t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((o=c&&Object.getOwnPropertyDescriptor(e,t))&&(o.get||o.set)?c(s,t,o):s[t]=e[t]);return s}const copyFiles=()=>{const e=gulpConfig.get("copyFiles",[]);return e.length?Promise.all(e.map(({from:e,to:r,base:o})=>new Promise((t,c)=>{(0,_copyFor.copyFor)(e,r,{base:o}).on("finish",t).on("error",c)}))).then(()=>{}):Promise.resolve()};exports.copyFiles=copyFiles;
package/dist/copyFonts.js CHANGED
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.copyFonts = void 0;
8
8
  var _copyFor = require("./partials/copyFor.js");
9
9
  var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ var cache;
11
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
11
12
  /**
12
13
  * Move the font files into the browser directory.
13
14
  * @memberOf module:js-build-tools
@@ -1 +1 @@
1
- "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.copyFonts=void 0;var _copyFor=require("./partials/copyFor.js"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js"));function _interopRequireWildcard(e,o){if("function"==typeof WeakMap)var r=new WeakMap,t=new WeakMap;return(_interopRequireWildcard=function(e,o){if(!o&&e&&e.__esModule)return e;var n,i,p={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return p;if(n=o?t:r){if(n.has(e))return n.get(e);n.set(e,p)}for(const o in e)"default"!==o&&{}.hasOwnProperty.call(e,o)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,o))&&(i.get||i.set)?n(p,o,i):p[o]=e[o]);return p})(e,o)}const copyFonts=()=>(0,_copyFor.copyFor)(gulpConfig.get("fonts.from"),gulpConfig.get("fonts.to"));exports.copyFonts=copyFonts;
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.copyFonts=void 0;var cache,_copyFor=require("./partials/copyFor.js"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js"));function _interopRequireWildcard(e,o){if(!o&&e&&e.__esModule)return e;var r,t,c=Object.defineProperty,n={__proto__:null,default:e};if(Object(e)!==e)return n;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,n)}for(t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((r=c&&Object.getOwnPropertyDescriptor(e,t))&&(r.get||r.set)?c(n,t,r):n[t]=e[t]);return n}const copyFonts=()=>(0,_copyFor.copyFor)(gulpConfig.get("fonts.from"),gulpConfig.get("fonts.to"));exports.copyFonts=copyFonts;
package/dist/default.js CHANGED
@@ -9,7 +9,8 @@ var _dist = require("./dist.js");
9
9
  var _bundle = require("./bundle.js");
10
10
  var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
11
11
  var _gulp = require("gulp");
12
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ var cache;
13
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
13
14
  /**
14
15
  * Recommended as the default task, runs the simple dist and bundle tasks.
15
16
  * @memberOf module:js-build-tools
@@ -1 +1 @@
1
- "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultCmd=void 0;var _dist=require("./dist.js"),_bundle=require("./bundle.js"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_gulp=require("gulp");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,u=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var i,n,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(i=r?u:t){if(i.has(e))return i.get(e);i.set(e,l)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(n.get||n.set)?i(l,r,n):l[r]=e[r]);return l})(e,r)}const defaultCmd=(e=null)=>gulpConfig.get("browser.enabled")?(0,_gulp.series)(_dist.dist,_bundle.bundle)(e):(0,_gulp.series)(_dist.dist)(e);exports.defaultCmd=defaultCmd;
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultCmd=void 0;var cache,_dist=require("./dist.js"),_bundle=require("./bundle.js"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_gulp=require("gulp");function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;var t,u,i=Object.defineProperty,l={__proto__:null,default:e};if(Object(e)!==e)return l;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,l)}for(u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((t=i&&Object.getOwnPropertyDescriptor(e,u))&&(t.get||t.set)?i(l,u,t):l[u]=e[u]);return l}const defaultCmd=(e=null)=>gulpConfig.get("browser.enabled")?(0,_gulp.series)(_dist.dist,_bundle.bundle)(e):(0,_gulp.series)(_dist.dist)(e);exports.defaultCmd=defaultCmd;
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.distMinify = void 0;
8
8
  var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
9
9
  var _minifyFor = require("./partials/minifyFor.js");
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ var cache;
11
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
11
12
  /**
12
13
  * Creates minified versions of the dist files.
13
14
  * @memberOf module:js-build-tools
@@ -1 +1 @@
1
- "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.distMinify=void 0;var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_minifyFor=require("./partials/minifyFor.js");function _interopRequireWildcard(e,i){if("function"==typeof WeakMap)var r=new WeakMap,t=new WeakMap;return(_interopRequireWildcard=function(e,i){if(!i&&e&&e.__esModule)return e;var n,o,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(n=i?t:r){if(n.has(e))return n.get(e);n.set(e,f)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(o.get||o.set)?n(f,i,o):f[i]=e[i]);return f})(e,i)}const distMinify=()=>(0,_minifyFor.minifyFor)(gulpConfig.get("browser.from"),gulpConfig.get("dist.to"));exports.distMinify=distMinify;
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.distMinify=void 0;var cache,gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_minifyFor=require("./partials/minifyFor.js");function _interopRequireWildcard(e,i){if(!i&&e&&e.__esModule)return e;var r,t,o=Object.defineProperty,n={__proto__:null,default:e};if(Object(e)!==e)return n;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,n)}for(t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((r=o&&Object.getOwnPropertyDescriptor(e,t))&&(r.get||r.set)?o(n,t,r):n[t]=e[t]);return n}const distMinify=()=>(0,_minifyFor.minifyFor)(gulpConfig.get("browser.from"),gulpConfig.get("dist.to"));exports.distMinify=distMinify;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.jsdocDocs = void 0;
7
+ var _jsdocDocsFor = require("./partials/jsdocDocsFor.js");
8
+ /**
9
+ * Generate the HTML documentation of a plain-JavaScript project from its source, with a modern jsdoc theme
10
+ * instead of jsdoc's own classic default. Turn it on with docs.enabled and docs.method: 'jsdoc' (the default
11
+ * when typescript.enabled is off), see {@link module:partials.jsdocDocsFor}.
12
+ * @memberOf module:js-build-tools
13
+ * @returns {Function}
14
+ */
15
+ const jsdocDocs = exports.jsdocDocs = (0, _jsdocDocsFor.jsdocDocsFor)();
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.jsdocDocs=void 0;var _jsdocDocsFor=require("./partials/jsdocDocsFor.js");const jsdocDocs=exports.jsdocDocs=(0,_jsdocDocsFor.jsdocDocsFor)();
@@ -10,7 +10,8 @@ var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
10
10
  var _jsdocToMarkdown = _interopRequireDefault(require("jsdoc-to-markdown"));
11
11
  var _glob = require("glob");
12
12
  var _convertMjsFilesForDocs = require("../utilities/convertMjsFilesForDocs.js");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ var cache;
14
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
16
  /**
16
17
  * Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
@@ -26,7 +27,7 @@ const addToReadme = () => {
26
27
  const {
27
28
  filePaths: esmFilePaths,
28
29
  cleanUp
29
- } = (0, _convertMjsFilesForDocs.convertMjsFilesForDocs)((0, _glob.globSync)(gulpConfig.get('readme.fromEsm') || []));
30
+ } = (0, _convertMjsFilesForDocs.convertMjsFilesForDocs)((0, _glob.globSync)(gulpConfig.get('readme.fromEsm')));
30
31
  return _jsdocToMarkdown.default.render({
31
32
  files: [...(0, _glob.globSync)(gulpConfig.get('readme.from')), ...esmFilePaths]
32
33
  }).finally(cleanUp).then(readme => _fs.default.appendFileSync(gulpConfig.get('readme.to') + gulpConfig.get('readme.file'), readme, gulpConfig.get('readmeOptions')));
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.beginWatcher = void 0;
8
8
  var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
9
9
  var _gulp = require("gulp");
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ var cache;
11
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
11
12
  /**
12
13
  * Create a chokidar instance which watches and triggers change when the globed files are modified.
13
14
  * @memberOf module:partials
@@ -9,7 +9,8 @@ require("core-js/modules/esnext.iterator.constructor.js");
9
9
  require("core-js/modules/esnext.iterator.reduce.js");
10
10
  var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
11
11
  var _removeDirectory = require("./removeDirectory.js");
12
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ var cache;
13
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
13
14
  /**
14
15
  * Deletes all the distribution and browser files (used before create a new build).
15
16
  * Configure array of directories to remove with 'cleanPaths'.
@@ -10,10 +10,18 @@ var _gulp = require("gulp");
10
10
  * @memberOf module:partials
11
11
  * @param {string|array} srcPath
12
12
  * @param {string} destPath
13
+ * @param {Object} [options]
14
+ * @param {string} [options.base] - Passed through to gulp's own src(pattern, {base}), to preserve srcPath's own
15
+ * subdirectory structure in destPath instead of flattening it.
13
16
  * @returns {stream.Stream}
14
17
  */
15
18
  // encoding: false copies the bytes untouched - Gulp 5's default utf8 handling corrupts binary files such as fonts.
16
- const copyFor = (srcPath, destPath) => (0, _gulp.src)(srcPath, {
17
- encoding: false
19
+ const copyFor = (srcPath, destPath, {
20
+ base
21
+ } = {}) => (0, _gulp.src)(srcPath, {
22
+ encoding: false,
23
+ ...(base ? {
24
+ base
25
+ } : {})
18
26
  }).pipe((0, _gulp.dest)(destPath));
19
27
  exports.copyFor = copyFor;