js-build-tools 5.2.0 → 5.3.1
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.
- package/README.md +101 -10
- package/dist/build.js +63 -58
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +27 -27
- package/dist/bundleLint.js +16 -16
- package/dist/bundleMinify.js +13 -13
- package/dist/compileReadme.js +10 -10
- package/dist/copyFonts.js +13 -13
- package/dist/default.js +15 -15
- package/dist/dist.js +10 -10
- package/dist/distLint.js +16 -16
- package/dist/distMinify.js +13 -13
- package/dist/images.js +10 -10
- package/dist/partials/addToReadme.js +17 -17
- package/dist/partials/beginWatcher.js +12 -12
- package/dist/partials/clean.js +14 -14
- package/dist/partials/copyFor.js +12 -12
- package/dist/partials/distFor.js +21 -21
- package/dist/partials/distForSrc.js +11 -11
- package/dist/partials/distSeries.js +19 -19
- package/dist/partials/imagesFor.js +7 -13
- package/dist/partials/loadPeer.js +99 -0
- package/dist/partials/minifyFor.js +16 -16
- package/dist/partials/readmeTemplate.js +14 -14
- package/dist/partials/removeDirectory.js +29 -29
- package/dist/partials/runOnChange.js +28 -28
- package/dist/partials/sassFor.js +28 -28
- package/dist/partials/standardLint.js +3 -5
- package/dist/partials/tsFor.js +8 -20
- package/dist/partials/typeDocsFor.js +228 -0
- package/dist/partials.js +26 -0
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +10 -10
- package/dist/test-helpers/setUp.js +89 -89
- package/dist/test-helpers/standardLintWithRealStandard.js +27 -27
- package/dist/testFull.js +20 -20
- package/dist/testHelpers.js +10 -10
- package/dist/testQuick.js +22 -22
- package/dist/typeDocs.js +14 -0
- package/dist/typeDocs.min.js +1 -0
- package/dist/typeScript.js +9 -9
- package/dist/utilities/dotGet.js +46 -46
- package/dist/utilities/dotNotate.js +46 -46
- package/dist/utilities/dotSet.js +37 -37
- package/dist/utilities/isObject.js +8 -8
- package/dist/utilities/strAfter.js +11 -11
- package/dist/utilities/strBefore.js +11 -11
- package/dist/watchFull.js +10 -10
- package/dist/watchTest.js +16 -16
- package/functions/build.mjs +7 -2
- package/functions/build.test.mjs +29 -0
- package/functions/partials/imagesFor.mjs +7 -13
- package/functions/partials/loadPeer.mjs +75 -0
- package/functions/partials/loadPeer.test.mjs +58 -0
- package/functions/partials/standardLint.mjs +3 -5
- package/functions/partials/tsFor.mjs +4 -20
- package/functions/partials/typeDocsFor.mjs +199 -0
- package/functions/partials/typeDocsFor.test.mjs +204 -0
- package/functions/partials.mjs +2 -0
- package/functions/partials.test.mjs +1 -1
- package/functions/typeDocs.mjs +9 -0
- package/functions/typeDocs.test.mjs +11 -0
- package/gulp.config.mjs +24 -2
- package/gulpfile.base.js +2 -0
- package/gulpfile.base.mjs +1 -0
- package/package.json +12 -7
|
@@ -1,94 +1,94 @@
|
|
|
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
|
-
Object.defineProperty(exports, "afterEach", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _testFilesystem.afterEach;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "beforeEach", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _testFilesystem.beforeEach;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "countMatches", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _testFilesystem.countMatches;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "createTempDir", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _testFilesystem.createTempDir;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "fileExists", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _testFilesystem.fileExists;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
exports.gulpConfig = void 0;
|
|
38
|
-
Object.defineProperty(exports, "logObject", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _testFilesystem.logObject;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, "removeDirectory", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return _testFilesystem.removeDirectory;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
exports.setDefaults = void 0;
|
|
51
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
52
|
-
exports.gulpConfig = gulpConfig;
|
|
53
|
-
var _testFilesystem = require("test-filesystem");
|
|
54
|
-
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); }
|
|
55
|
-
// Import the configurations and override some of them to direct to the temp directory.
|
|
56
|
-
|
|
57
|
-
let tempDir = 'test-temp/';
|
|
58
|
-
let srcPath = `${tempDir}src`;
|
|
59
|
-
|
|
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
|
+
Object.defineProperty(exports, "afterEach", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _testFilesystem.afterEach;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "beforeEach", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _testFilesystem.beforeEach;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "countMatches", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _testFilesystem.countMatches;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "createTempDir", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _testFilesystem.createTempDir;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "fileExists", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _testFilesystem.fileExists;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
exports.gulpConfig = void 0;
|
|
38
|
+
Object.defineProperty(exports, "logObject", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _testFilesystem.logObject;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "removeDirectory", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _testFilesystem.removeDirectory;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
exports.setDefaults = void 0;
|
|
51
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
52
|
+
exports.gulpConfig = gulpConfig;
|
|
53
|
+
var _testFilesystem = require("test-filesystem");
|
|
54
|
+
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); }
|
|
55
|
+
// Import the configurations and override some of them to direct to the temp directory.
|
|
56
|
+
|
|
57
|
+
let tempDir = 'test-temp/';
|
|
58
|
+
let srcPath = `${tempDir}src`;
|
|
59
|
+
|
|
60
60
|
/**
|
|
61
61
|
* Update the gulp configurations with the test data. Set the test directory where temp files will be created for testing.
|
|
62
62
|
* @memberOf module:testHelpers
|
|
63
63
|
* @param {string} testDir
|
|
64
|
-
*/
|
|
65
|
-
const setDefaults = (testDir = 'test-temp') => {
|
|
66
|
-
tempDir = `${testDir}/`;
|
|
67
|
-
srcPath = `${tempDir}src`;
|
|
68
|
-
_testFilesystem.setUp.setDefaults(tempDir);
|
|
69
|
-
const distPath = `${tempDir}dist`;
|
|
70
|
-
const browserPath = `${tempDir}browser`;
|
|
71
|
-
const sassPath = `${tempDir}sass`;
|
|
72
|
-
gulpConfig.set('browser.from', `${distPath}/**/*.js`);
|
|
73
|
-
gulpConfig.set('browser.to', browserPath);
|
|
74
|
-
gulpConfig.set('cleanPaths', [distPath, browserPath]);
|
|
75
|
-
gulpConfig.set('dist.from', `${srcPath}/**/!(*.test).js`);
|
|
76
|
-
gulpConfig.set('dist.main', `${distPath}/main`);
|
|
77
|
-
gulpConfig.set('dist.to', distPath);
|
|
78
|
-
gulpConfig.set('fonts.from', `${srcPath}/fonts/**/*`);
|
|
79
|
-
gulpConfig.set('fonts.to', `${browserPath}/fonts`);
|
|
80
|
-
gulpConfig.set('images.from', `${srcPath}/img/**/*.+(png|jpg|jpeg|gif|svg)`);
|
|
81
|
-
gulpConfig.set('images.to', `${browserPath}/img`);
|
|
82
|
-
gulpConfig.set('readme.template', `${tempDir}MAIN.md`);
|
|
83
|
-
gulpConfig.set('readme.to', tempDir);
|
|
84
|
-
gulpConfig.set('readme.from', `${srcPath}/**/!(*.test).js`);
|
|
85
|
-
gulpConfig.set('rootPath', tempDir);
|
|
86
|
-
gulpConfig.set('sass.from', `${sassPath}/**/*.+(scss|sass)`);
|
|
87
|
-
gulpConfig.set('sass.path', sassPath);
|
|
88
|
-
gulpConfig.set('sass.to', `${browserPath}/css`);
|
|
89
|
-
gulpConfig.set('srcPath', srcPath);
|
|
90
|
-
gulpConfig.set('typescript.from', `${srcPath}/**/*.ts`);
|
|
91
|
-
gulpConfig.set('typescript.to', distPath);
|
|
92
|
-
gulpConfig.set('test.watch', `${srcPath}/**/*.js`);
|
|
93
|
-
};
|
|
64
|
+
*/
|
|
65
|
+
const setDefaults = (testDir = 'test-temp') => {
|
|
66
|
+
tempDir = `${testDir}/`;
|
|
67
|
+
srcPath = `${tempDir}src`;
|
|
68
|
+
_testFilesystem.setUp.setDefaults(tempDir);
|
|
69
|
+
const distPath = `${tempDir}dist`;
|
|
70
|
+
const browserPath = `${tempDir}browser`;
|
|
71
|
+
const sassPath = `${tempDir}sass`;
|
|
72
|
+
gulpConfig.set('browser.from', `${distPath}/**/*.js`);
|
|
73
|
+
gulpConfig.set('browser.to', browserPath);
|
|
74
|
+
gulpConfig.set('cleanPaths', [distPath, browserPath]);
|
|
75
|
+
gulpConfig.set('dist.from', `${srcPath}/**/!(*.test).js`);
|
|
76
|
+
gulpConfig.set('dist.main', `${distPath}/main`);
|
|
77
|
+
gulpConfig.set('dist.to', distPath);
|
|
78
|
+
gulpConfig.set('fonts.from', `${srcPath}/fonts/**/*`);
|
|
79
|
+
gulpConfig.set('fonts.to', `${browserPath}/fonts`);
|
|
80
|
+
gulpConfig.set('images.from', `${srcPath}/img/**/*.+(png|jpg|jpeg|gif|svg)`);
|
|
81
|
+
gulpConfig.set('images.to', `${browserPath}/img`);
|
|
82
|
+
gulpConfig.set('readme.template', `${tempDir}MAIN.md`);
|
|
83
|
+
gulpConfig.set('readme.to', tempDir);
|
|
84
|
+
gulpConfig.set('readme.from', `${srcPath}/**/!(*.test).js`);
|
|
85
|
+
gulpConfig.set('rootPath', tempDir);
|
|
86
|
+
gulpConfig.set('sass.from', `${sassPath}/**/*.+(scss|sass)`);
|
|
87
|
+
gulpConfig.set('sass.path', sassPath);
|
|
88
|
+
gulpConfig.set('sass.to', `${browserPath}/css`);
|
|
89
|
+
gulpConfig.set('srcPath', srcPath);
|
|
90
|
+
gulpConfig.set('typescript.from', `${srcPath}/**/*.ts`);
|
|
91
|
+
gulpConfig.set('typescript.to', distPath);
|
|
92
|
+
gulpConfig.set('test.watch', `${srcPath}/**/*.js`);
|
|
93
|
+
};
|
|
94
94
|
exports.setDefaults = setDefaults;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.standardLint = exports.loadStandardViaSubprocess = void 0;
|
|
7
|
-
require("core-js/modules/es.json.stringify.js");
|
|
8
|
-
var _nodeChild_process = require("node:child_process");
|
|
9
|
-
// Jest's CommonJS transform cannot load `standard` (ESM-only) or run a real dynamic import(), so tests that need
|
|
10
|
-
// genuine Standard behavior run the actual `standard` package in a plain Node subprocess instead of faking it.
|
|
11
|
-
const script = 'import { readFileSync } from \'node:fs\'\n' + 'import standard from \'standard\'\n' + 'const { text, options } = JSON.parse(readFileSync(0, \'utf8\'))\n' + 'process.stdout.write(JSON.stringify(await standard.lintText(text, options)))\n';
|
|
12
|
-
const loadStandardViaSubprocess = () => Promise.resolve({
|
|
13
|
-
lintText: (text, options) => Promise.resolve().then(() => JSON.parse((0, _nodeChild_process.execFileSync)(process.execPath, ['--input-type=module', '--eval', script], {
|
|
14
|
-
input: JSON.stringify({
|
|
15
|
-
text,
|
|
16
|
-
options
|
|
17
|
-
}),
|
|
18
|
-
encoding: 'utf8',
|
|
19
|
-
cwd: process.cwd(),
|
|
20
|
-
maxBuffer: 256 * 1024 * 1024
|
|
21
|
-
})))
|
|
22
|
-
});
|
|
23
|
-
exports.loadStandardViaSubprocess = loadStandardViaSubprocess;
|
|
24
|
-
const actual = jest.requireActual('../partials/standardLint.js');
|
|
25
|
-
|
|
26
|
-
// Drop-in replacement for the partial module (see jest.mock in the lint/build tests): same API, real Standard.
|
|
27
|
-
const standardLint = options => actual.standardLint(options, loadStandardViaSubprocess);
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.standardLint = exports.loadStandardViaSubprocess = void 0;
|
|
7
|
+
require("core-js/modules/es.json.stringify.js");
|
|
8
|
+
var _nodeChild_process = require("node:child_process");
|
|
9
|
+
// Jest's CommonJS transform cannot load `standard` (ESM-only) or run a real dynamic import(), so tests that need
|
|
10
|
+
// genuine Standard behavior run the actual `standard` package in a plain Node subprocess instead of faking it.
|
|
11
|
+
const script = 'import { readFileSync } from \'node:fs\'\n' + 'import standard from \'standard\'\n' + 'const { text, options } = JSON.parse(readFileSync(0, \'utf8\'))\n' + 'process.stdout.write(JSON.stringify(await standard.lintText(text, options)))\n';
|
|
12
|
+
const loadStandardViaSubprocess = () => Promise.resolve({
|
|
13
|
+
lintText: (text, options) => Promise.resolve().then(() => JSON.parse((0, _nodeChild_process.execFileSync)(process.execPath, ['--input-type=module', '--eval', script], {
|
|
14
|
+
input: JSON.stringify({
|
|
15
|
+
text,
|
|
16
|
+
options
|
|
17
|
+
}),
|
|
18
|
+
encoding: 'utf8',
|
|
19
|
+
cwd: process.cwd(),
|
|
20
|
+
maxBuffer: 256 * 1024 * 1024
|
|
21
|
+
})))
|
|
22
|
+
});
|
|
23
|
+
exports.loadStandardViaSubprocess = loadStandardViaSubprocess;
|
|
24
|
+
const actual = jest.requireActual('../partials/standardLint.js');
|
|
25
|
+
|
|
26
|
+
// Drop-in replacement for the partial module (see jest.mock in the lint/build tests): same API, real Standard.
|
|
27
|
+
const standardLint = options => actual.standardLint(options, loadStandardViaSubprocess);
|
|
28
28
|
exports.standardLint = standardLint;
|
package/dist/testFull.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
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.testFull = void 0
|
|
8
|
-
const gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
|
|
9
|
-
const _jest = require('jest')
|
|
10
|
-
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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) }
|
|
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.testFull = void 0
|
|
8
|
+
const gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
|
|
9
|
+
const _jest = require('jest')
|
|
10
|
+
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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) }
|
|
11
11
|
/**
|
|
12
12
|
* Run all tests with jest.
|
|
13
13
|
* Configure where tests are located by using 'testPath'.
|
|
14
14
|
* @memberOf module:js-build-tools
|
|
15
15
|
* @returns {Promise<*>}
|
|
16
|
-
*/
|
|
17
|
-
const testFull = () => {
|
|
18
|
-
let testPath = gulpConfig.get('test.path')
|
|
19
|
-
if (!Array.isArray(testPath)) {
|
|
20
|
-
// The testPath must be an array of strings
|
|
21
|
-
testPath = [testPath]
|
|
22
|
-
}
|
|
23
|
-
return (0, _jest.runCLI)(gulpConfig.get('test.options'), testPath)
|
|
24
|
-
}
|
|
25
|
-
exports.testFull = testFull
|
|
16
|
+
*/
|
|
17
|
+
const testFull = () => {
|
|
18
|
+
let testPath = gulpConfig.get('test.path')
|
|
19
|
+
if (!Array.isArray(testPath)) {
|
|
20
|
+
// The testPath must be an array of strings
|
|
21
|
+
testPath = [testPath]
|
|
22
|
+
}
|
|
23
|
+
return (0, _jest.runCLI)(gulpConfig.get('test.options'), testPath)
|
|
24
|
+
}
|
|
25
|
+
exports.testFull = testFull
|
package/dist/testHelpers.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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.testHelpers = void 0
|
|
8
|
-
const _testHelpers = _interopRequireWildcard(require('./test-helpers/setUp.js'))
|
|
9
|
-
exports.testHelpers = _testHelpers
|
|
10
|
-
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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) }
|
|
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.testHelpers = void 0
|
|
8
|
+
const _testHelpers = _interopRequireWildcard(require('./test-helpers/setUp.js'))
|
|
9
|
+
exports.testHelpers = _testHelpers
|
|
10
|
+
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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) }
|
package/dist/testQuick.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
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.testQuick = void 0
|
|
8
|
-
const gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
|
|
9
|
-
const _jest = require('jest')
|
|
10
|
-
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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) }
|
|
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.testQuick = void 0
|
|
8
|
+
const gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
|
|
9
|
+
const _jest = require('jest')
|
|
10
|
+
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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) }
|
|
11
11
|
/**
|
|
12
12
|
* Run the Jest tests for files which have been modified (based on git status).
|
|
13
13
|
* Configure where tests are located by using 'testPath'.
|
|
14
14
|
* @memberOf module:js-build-tools
|
|
15
15
|
* @returns {Promise<*>}
|
|
16
|
-
*/
|
|
17
|
-
const testQuick = () => {
|
|
18
|
-
let testPath = gulpConfig.get('test.path')
|
|
19
|
-
if (!Array.isArray(testPath)) {
|
|
20
|
-
// The testPath must be an array of strings
|
|
21
|
-
testPath = [testPath]
|
|
22
|
-
}
|
|
23
|
-
return (0, _jest.runCLI)({
|
|
24
|
-
onlyChanged: true
|
|
25
|
-
}, testPath)
|
|
26
|
-
}
|
|
27
|
-
exports.testQuick = testQuick
|
|
16
|
+
*/
|
|
17
|
+
const testQuick = () => {
|
|
18
|
+
let testPath = gulpConfig.get('test.path')
|
|
19
|
+
if (!Array.isArray(testPath)) {
|
|
20
|
+
// The testPath must be an array of strings
|
|
21
|
+
testPath = [testPath]
|
|
22
|
+
}
|
|
23
|
+
return (0, _jest.runCLI)({
|
|
24
|
+
onlyChanged: true
|
|
25
|
+
}, testPath)
|
|
26
|
+
}
|
|
27
|
+
exports.testQuick = testQuick
|
package/dist/typeDocs.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.typeDocs = void 0
|
|
7
|
+
const _typeDocsFor = require('./partials/typeDocsFor.js')
|
|
8
|
+
/**
|
|
9
|
+
* Generate the HTML documentation of a TypeScript project from its source, with the modules mirroring the source
|
|
10
|
+
* folders. Turn it on with docs.enabled, see {@link module:partials.typeDocsFor}.
|
|
11
|
+
* @memberOf module:js-build-tools
|
|
12
|
+
* @returns {Function}
|
|
13
|
+
*/
|
|
14
|
+
const typeDocs = exports.typeDocs = (0, _typeDocsFor.typeDocsFor)()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.typeDocs=void 0;var _typeDocsFor=require("./partials/typeDocsFor.js");const typeDocs=exports.typeDocs=(0,_typeDocsFor.typeDocsFor)();
|
package/dist/typeScript.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.typeScript = void 0
|
|
7
|
-
const _tsFor = require('./partials/tsFor.js')
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.typeScript = void 0
|
|
7
|
+
const _tsFor = require('./partials/tsFor.js')
|
|
8
8
|
/**
|
|
9
9
|
* Simplified typescript task using tsFor.
|
|
10
10
|
* @memberOf module:js-build-tools
|
|
11
11
|
* @returns {Function}
|
|
12
|
-
*/
|
|
13
|
-
const typeScript = exports.typeScript = (0, _tsFor.tsFor)()
|
|
12
|
+
*/
|
|
13
|
+
const typeScript = exports.typeScript = (0, _tsFor.tsFor)()
|
package/dist/utilities/dotGet.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dotGet = void 0;
|
|
7
|
-
var _isObject = require("./isObject.js");
|
|
8
|
-
var _strAfter = require("./strAfter.js");
|
|
9
|
-
var _strBefore = require("./strBefore.js");
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.dotGet = void 0;
|
|
7
|
+
var _isObject = require("./isObject.js");
|
|
8
|
+
var _strAfter = require("./strAfter.js");
|
|
9
|
+
var _strBefore = require("./strBefore.js");
|
|
10
10
|
/**
|
|
11
11
|
* Get a nested property value from an object.
|
|
12
12
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotGet.ts Sí, funciona}
|
|
@@ -14,41 +14,41 @@ var _strBefore = require("./strBefore.js");
|
|
|
14
14
|
* @param {string} [dotNotation=''] - The path to the property
|
|
15
15
|
* @param {string|null} [defaultValue=null] - The default value to return if the property is not found
|
|
16
16
|
* @returns {*} The value of the property
|
|
17
|
-
*/
|
|
18
|
-
const dotGet = (arrayObject = {}, dotNotation = '', defaultValue = null) => {
|
|
19
|
-
if (!dotNotation) {
|
|
20
|
-
return arrayObject;
|
|
21
|
-
}
|
|
22
|
-
let key = (0, _strBefore.strBefore)(dotNotation, '.');
|
|
23
|
-
const lastKey = !key;
|
|
24
|
-
if (lastKey) {
|
|
25
|
-
key = dotNotation;
|
|
26
|
-
}
|
|
27
|
-
if (key === '*') {
|
|
28
|
-
const result = [];
|
|
29
|
-
for (let wildKey in arrayObject) {
|
|
30
|
-
const wildValue = arrayObject[wildKey];
|
|
31
|
-
if (lastKey) {
|
|
32
|
-
result[wildKey] = wildValue;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (!(0, _isObject.isObject)(wildValue)) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
result[wildKey] = dotGet(wildValue, (0, _strAfter.strAfter)(dotNotation, '.'), defaultValue);
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
if (lastKey) {
|
|
43
|
-
return arrayObject[dotNotation] ?? defaultValue;
|
|
44
|
-
}
|
|
45
|
-
if (typeof arrayObject[key] === 'undefined') {
|
|
46
|
-
return defaultValue;
|
|
47
|
-
}
|
|
48
|
-
const next = arrayObject[key];
|
|
49
|
-
if (!(0, _isObject.isObject)(next)) {
|
|
50
|
-
return defaultValue;
|
|
51
|
-
}
|
|
52
|
-
return dotGet(next, (0, _strAfter.strAfter)(dotNotation, '.'), defaultValue);
|
|
53
|
-
};
|
|
17
|
+
*/
|
|
18
|
+
const dotGet = (arrayObject = {}, dotNotation = '', defaultValue = null) => {
|
|
19
|
+
if (!dotNotation) {
|
|
20
|
+
return arrayObject;
|
|
21
|
+
}
|
|
22
|
+
let key = (0, _strBefore.strBefore)(dotNotation, '.');
|
|
23
|
+
const lastKey = !key;
|
|
24
|
+
if (lastKey) {
|
|
25
|
+
key = dotNotation;
|
|
26
|
+
}
|
|
27
|
+
if (key === '*') {
|
|
28
|
+
const result = [];
|
|
29
|
+
for (let wildKey in arrayObject) {
|
|
30
|
+
const wildValue = arrayObject[wildKey];
|
|
31
|
+
if (lastKey) {
|
|
32
|
+
result[wildKey] = wildValue;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (!(0, _isObject.isObject)(wildValue)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
result[wildKey] = dotGet(wildValue, (0, _strAfter.strAfter)(dotNotation, '.'), defaultValue);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
if (lastKey) {
|
|
43
|
+
return arrayObject[dotNotation] ?? defaultValue;
|
|
44
|
+
}
|
|
45
|
+
if (typeof arrayObject[key] === 'undefined') {
|
|
46
|
+
return defaultValue;
|
|
47
|
+
}
|
|
48
|
+
const next = arrayObject[key];
|
|
49
|
+
if (!(0, _isObject.isObject)(next)) {
|
|
50
|
+
return defaultValue;
|
|
51
|
+
}
|
|
52
|
+
return dotGet(next, (0, _strAfter.strAfter)(dotNotation, '.'), defaultValue);
|
|
53
|
+
};
|
|
54
54
|
exports.dotGet = dotGet;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dotNotate = void 0;
|
|
7
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
-
var _isObject = require("./isObject.js");
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.dotNotate = void 0;
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
+
var _isObject = require("./isObject.js");
|
|
10
10
|
/**
|
|
11
11
|
* Convert an array of keys into a regex, return a function to test if incoming keys match.
|
|
12
12
|
* @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
|
|
13
13
|
* @returns {Function} The dot-notated array
|
|
14
|
-
*/
|
|
15
|
-
const handleRetainObjects = (retainObjects = []) => {
|
|
16
|
-
if (!retainObjects.length) {
|
|
14
|
+
*/
|
|
15
|
+
const handleRetainObjects = (retainObjects = []) => {
|
|
16
|
+
if (!retainObjects.length) {
|
|
17
17
|
/**
|
|
18
18
|
* Bypass the test function if there are no retainObjects.
|
|
19
19
|
* @returns {false}
|
|
20
|
-
*/
|
|
21
|
-
return (currentKey, value, results) => false;
|
|
22
|
-
}
|
|
23
|
-
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
24
|
-
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
|
|
20
|
+
*/
|
|
21
|
+
return (currentKey, value, results) => false;
|
|
22
|
+
}
|
|
23
|
+
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
24
|
+
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
|
|
25
25
|
/**
|
|
26
26
|
* Test if a key should be retained as an object.
|
|
27
27
|
* @param {string} currentKey - The key to test
|
|
28
28
|
* @param {*} value - The value of the key
|
|
29
29
|
* @param {Object} results - The result object to add to
|
|
30
30
|
* @returns {boolean}
|
|
31
|
-
*/
|
|
32
|
-
return (currentKey, value, results) => {
|
|
33
|
-
if (!currentKey.match(retainRegex)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
results[currentKey] = value;
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
31
|
+
*/
|
|
32
|
+
return (currentKey, value, results) => {
|
|
33
|
+
if (!currentKey.match(retainRegex)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
results[currentKey] = value;
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
41
|
/**
|
|
42
42
|
* The underlying logic function for converting arrays to dot-notation.
|
|
43
43
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
@@ -45,29 +45,29 @@ const handleRetainObjects = (retainObjects = []) => {
|
|
|
45
45
|
* @param {string} [prepend=''] - The path for the property being processed
|
|
46
46
|
* @param {Object<string, *>} [results={}] - The final notated object to return
|
|
47
47
|
* @returns {Object<string, *>} The dot-notated object
|
|
48
|
-
*/
|
|
49
|
-
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
50
|
-
for (let key in arrayObject) {
|
|
51
|
-
const value = arrayObject[key];
|
|
52
|
-
const currentKey = `${prepend}${key}`;
|
|
53
|
-
if (didRetain(currentKey, value, results)) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if ((0, _isObject.isObject)(value)) {
|
|
57
|
-
performDotNotate(value, didRetain, `${currentKey}.`, results);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
results[currentKey] = value;
|
|
61
|
-
}
|
|
62
|
-
return results;
|
|
63
|
-
};
|
|
64
|
-
|
|
48
|
+
*/
|
|
49
|
+
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
50
|
+
for (let key in arrayObject) {
|
|
51
|
+
const value = arrayObject[key];
|
|
52
|
+
const currentKey = `${prepend}${key}`;
|
|
53
|
+
if (didRetain(currentKey, value, results)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if ((0, _isObject.isObject)(value)) {
|
|
57
|
+
performDotNotate(value, didRetain, `${currentKey}.`, results);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
results[currentKey] = value;
|
|
61
|
+
}
|
|
62
|
+
return results;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
65
|
/**
|
|
66
66
|
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
67
67
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotNotate.ts Sí, funciona}
|
|
68
68
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
69
69
|
* @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
|
|
70
70
|
* @returns {Object<string, *>} The dot-notated object
|
|
71
|
-
*/
|
|
72
|
-
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
71
|
+
*/
|
|
72
|
+
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
73
73
|
exports.dotNotate = dotNotate;
|