@modern-js/utils 1.3.6 → 1.3.8-canary.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.
- package/.eslintrc.js +9 -0
- package/CHANGELOG.md +6 -0
- package/compiled/browserslist/index.d.ts +178 -0
- package/compiled/browserslist/index.js +1 -0
- package/compiled/browserslist/license +20 -0
- package/compiled/browserslist/package.json +1 -0
- package/compiled/chalk/index.d.ts +415 -0
- package/compiled/chalk/index.js +1 -0
- package/compiled/chalk/license +9 -0
- package/compiled/chalk/package.json +1 -0
- package/compiled/chokidar/anymatch/index.d.ts +19 -0
- package/compiled/chokidar/fsevents.node +0 -0
- package/compiled/chokidar/index.js +40 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/chokidar/types/index.d.ts +188 -0
- package/compiled/commander/index.js +1 -0
- package/compiled/commander/license +22 -0
- package/compiled/commander/package.json +1 -0
- package/compiled/commander/typings/index.d.ts +774 -0
- package/compiled/debug/index.d.ts +54 -0
- package/compiled/debug/index.js +1 -0
- package/compiled/debug/license +20 -0
- package/compiled/debug/ms/index.d.ts +25 -0
- package/compiled/debug/package.json +1 -0
- package/compiled/execa/index.d.ts +564 -0
- package/compiled/execa/index.js +1 -0
- package/compiled/execa/license +9 -0
- package/compiled/execa/package.json +1 -0
- package/compiled/filesize/filesize.d.ts +131 -0
- package/compiled/filesize/index.js +9 -0
- package/compiled/filesize/license +28 -0
- package/compiled/filesize/package.json +1 -0
- package/compiled/fs-extra/index.d.ts +563 -0
- package/compiled/fs-extra/index.js +1 -0
- package/compiled/fs-extra/license +15 -0
- package/compiled/fs-extra/package.json +1 -0
- package/compiled/glob/index.d.ts +91 -0
- package/compiled/glob/index.js +1 -0
- package/compiled/glob/license +21 -0
- package/compiled/glob/minimatch/index.d.ts +204 -0
- package/compiled/glob/package.json +1 -0
- package/compiled/gzip-size/index.d.ts +96 -0
- package/compiled/gzip-size/index.js +1 -0
- package/compiled/gzip-size/license +9 -0
- package/compiled/gzip-size/package.json +1 -0
- package/compiled/import-lazy/index.d.ts +26 -0
- package/compiled/import-lazy/index.js +1 -0
- package/compiled/import-lazy/license +9 -0
- package/compiled/import-lazy/package.json +1 -0
- package/compiled/js-yaml/index.d.ts +154 -0
- package/compiled/js-yaml/index.js +1 -0
- package/compiled/js-yaml/license +21 -0
- package/compiled/js-yaml/package.json +1 -0
- package/compiled/lodash/common/array.d.ts +2126 -0
- package/compiled/lodash/common/collection.d.ts +1930 -0
- package/compiled/lodash/common/common.d.ts +280 -0
- package/compiled/lodash/common/date.d.ts +23 -0
- package/compiled/lodash/common/function.d.ts +1446 -0
- package/compiled/lodash/common/lang.d.ts +1693 -0
- package/compiled/lodash/common/math.d.ts +405 -0
- package/compiled/lodash/common/number.d.ts +131 -0
- package/compiled/lodash/common/object.d.ts +2519 -0
- package/compiled/lodash/common/seq.d.ts +210 -0
- package/compiled/lodash/common/string.d.ts +788 -0
- package/compiled/lodash/common/util.d.ts +1220 -0
- package/compiled/lodash/index.d.ts +46 -0
- package/compiled/lodash/index.js +9 -0
- package/compiled/lodash/license +47 -0
- package/compiled/lodash/package.json +1 -0
- package/compiled/pkg-up/index.d.ts +48 -0
- package/compiled/pkg-up/index.js +1 -0
- package/compiled/pkg-up/license +9 -0
- package/compiled/pkg-up/package.json +1 -0
- package/compiled/recursive-readdir/index.d.ts +21 -0
- package/compiled/recursive-readdir/index.js +1 -0
- package/compiled/recursive-readdir/license +21 -0
- package/compiled/recursive-readdir/package.json +1 -0
- package/compiled/signale/index.d.ts +162 -0
- package/compiled/signale/index.js +1 -0
- package/compiled/signale/package.json +1 -0
- package/compiled/strip-ansi/index.d.ts +17 -0
- package/compiled/strip-ansi/index.js +1 -0
- package/compiled/strip-ansi/license +9 -0
- package/compiled/strip-ansi/package.json +1 -0
- package/compiled/upath/index.js +1 -0
- package/compiled/upath/license +22 -0
- package/compiled/upath/package.json +1 -0
- package/compiled/upath/upath.d.ts +241 -0
- package/dist/FileSizeReporter.d.ts +16 -0
- package/dist/FileSizeReporter.js +151 -0
- package/dist/alias.d.ts +21 -0
- package/dist/alias.js +62 -0
- package/dist/applyOptionsChain.d.ts +6 -0
- package/dist/applyOptionsChain.js +30 -0
- package/dist/clearConsole.d.ts +1 -0
- package/dist/clearConsole.js +9 -0
- package/dist/compatRequire.d.ts +8 -0
- package/dist/compatRequire.js +28 -0
- package/dist/compiled.d.ts +21 -0
- package/dist/compiled.js +33 -0
- package/dist/constants.d.ts +222 -0
- package/dist/constants.js +277 -0
- package/dist/{js/modern/debug.js → debug.d.ts} +1 -3
- package/dist/debug.js +11 -0
- package/dist/emptyDir.d.ts +1 -0
- package/dist/emptyDir.js +19 -0
- package/dist/{js/modern/ensureAbsolutePath.js → ensureAbsolutePath.d.ts} +1 -3
- package/dist/ensureAbsolutePath.js +15 -0
- package/dist/findExists.d.ts +6 -0
- package/dist/findExists.js +21 -0
- package/dist/format.d.ts +16 -0
- package/dist/format.js +113 -0
- package/dist/generateMetaTags.d.ts +16 -0
- package/dist/generateMetaTags.js +48 -0
- package/dist/getBrowserslist.d.ts +2 -0
- package/dist/getBrowserslist.js +7 -0
- package/dist/getCacheIdentifier.d.ts +7 -0
- package/dist/getCacheIdentifier.js +24 -0
- package/dist/getEntryOptions.d.ts +1 -0
- package/dist/getEntryOptions.js +26 -0
- package/dist/getPackageManager.d.ts +1 -0
- package/dist/getPackageManager.js +47 -0
- package/dist/getPort.d.ts +7 -0
- package/dist/getPort.js +62 -0
- package/dist/getServerConfig.d.ts +1 -0
- package/dist/getServerConfig.js +39 -0
- package/dist/import.d.ts +5 -0
- package/dist/import.js +10 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +45 -0
- package/dist/is/index.d.ts +34 -0
- package/dist/is/index.js +82 -0
- package/dist/is/node-env.d.ts +4 -0
- package/dist/is/node-env.js +12 -0
- package/dist/is/platform.d.ts +2 -0
- package/dist/is/platform.js +10 -0
- package/dist/is/type.d.ts +8 -0
- package/dist/is/type.js +38 -0
- package/dist/js/modern/monorepo.js +4 -5
- package/dist/js/node/monorepo.js +5 -7
- package/dist/js/treeshaking/monorepo.js +7 -6
- package/dist/logger.d.ts +63 -0
- package/dist/logger.js +128 -0
- package/dist/monorepo.d.ts +11 -0
- package/dist/monorepo.js +80 -0
- package/dist/nodeEnv.d.ts +3 -0
- package/dist/nodeEnv.js +49 -0
- package/dist/path.d.ts +3 -0
- package/dist/path.js +14 -0
- package/dist/{types/pkgUp.d.ts → pkgUp.d.ts} +1 -1
- package/dist/pkgUp.js +8 -0
- package/dist/prettyInstructions.d.ts +6 -0
- package/dist/prettyInstructions.js +64 -0
- package/dist/printBuildError.d.ts +8 -0
- package/dist/printBuildError.js +43 -0
- package/dist/readTsConfig.d.ts +2 -0
- package/dist/readTsConfig.js +19 -0
- package/dist/removeSlash.d.ts +3 -0
- package/dist/removeSlash.js +9 -0
- package/dist/runtimeExports.d.ts +4 -0
- package/dist/runtimeExports.js +53 -0
- package/dist/ssrHelpers.d.ts +4 -0
- package/dist/ssrHelpers.js +7 -0
- package/dist/storage.d.ts +5 -0
- package/dist/storage.js +61 -0
- package/dist/types/FileSizeReporter.d.ts +5 -5
- package/dist/types/alias.d.ts +12 -14
- package/dist/types/applyOptionsChain.d.ts +5 -5
- package/dist/types/clearConsole.d.ts +1 -1
- package/dist/types/compatRequire.d.ts +1 -1
- package/dist/types/compiled.d.ts +17 -0
- package/dist/types/constants.d.ts +165 -162
- package/dist/types/debug.d.ts +1 -3
- package/dist/types/emptyDir.d.ts +1 -1
- package/dist/types/ensureAbsolutePath.d.ts +1 -1
- package/dist/types/findExists.d.ts +1 -1
- package/dist/types/format.d.ts +5 -5
- package/dist/types/generateMetaTags.d.ts +3 -3
- package/dist/types/getBrowserslist.d.ts +1 -1
- package/dist/types/getCacheIdentifier.d.ts +3 -3
- package/dist/types/getEntryOptions.d.ts +1 -1
- package/dist/types/getPackageManager.d.ts +1 -1
- package/dist/types/getPort.d.ts +1 -1
- package/dist/types/getServerConfig.d.ts +1 -0
- package/dist/types/import.d.ts +2 -2
- package/dist/types/index.d.ts +3 -4
- package/dist/types/is/index.d.ts +1 -4
- package/dist/types/is/node-env.d.ts +1 -1
- package/dist/types/is/platform.d.ts +1 -1
- package/dist/types/is/type.d.ts +1 -1
- package/dist/types/logger.d.ts +49 -49
- package/dist/types/monorepo.d.ts +3 -3
- package/dist/types/nodeEnv.d.ts +1 -1
- package/dist/types/path.d.ts +1 -1
- package/dist/types/prettyInstructions.d.ts +2 -2
- package/dist/types/printBuildError.d.ts +1 -1
- package/dist/types/readTsConfig.d.ts +1 -1
- package/dist/types/removeSlash.d.ts +1 -1
- package/dist/types/runtimeExports.d.ts +3 -3
- package/dist/types/wait.d.ts +1 -1
- package/dist/types/watch.d.ts +4 -4
- package/dist/wait.d.ts +2 -0
- package/dist/wait.js +7 -0
- package/dist/watch.d.ts +8 -0
- package/dist/watch.js +64 -0
- package/jest.config.js +0 -1
- package/package.json +57 -40
- package/tests/debug.test.ts +2 -2
- package/tests/is.test.ts +27 -0
- package/tests/isPlatform.test.ts +19 -0
- package/tests/prettyInstructions.test.ts +1 -1
- package/tsconfig.json +3 -5
- package/dist/js/modern/FileSizeReporter.js +0 -156
- package/dist/js/modern/alias.js +0 -74
- package/dist/js/modern/applyOptionsChain.js +0 -27
- package/dist/js/modern/chalk.js +0 -2
- package/dist/js/modern/clearConsole.js +0 -5
- package/dist/js/modern/compatRequire.js +0 -26
- package/dist/js/modern/constants.js +0 -333
- package/dist/js/modern/emptyDir.js +0 -6
- package/dist/js/modern/findExists.js +0 -16
- package/dist/js/modern/format.js +0 -137
- package/dist/js/modern/generateMetaTags.js +0 -49
- package/dist/js/modern/getBrowserslist.js +0 -5
- package/dist/js/modern/getCacheIdentifier.js +0 -20
- package/dist/js/modern/getEntryOptions.js +0 -24
- package/dist/js/modern/getPackageManager.js +0 -37
- package/dist/js/modern/getPort.js +0 -52
- package/dist/js/modern/import.js +0 -11
- package/dist/js/modern/index.js +0 -34
- package/dist/js/modern/is/index.js +0 -77
- package/dist/js/modern/is/node-env.js +0 -5
- package/dist/js/modern/is/platform.js +0 -2
- package/dist/js/modern/is/type.js +0 -27
- package/dist/js/modern/logger.js +0 -152
- package/dist/js/modern/nodeEnv.js +0 -31
- package/dist/js/modern/path.js +0 -5
- package/dist/js/modern/pkgUp.js +0 -2
- package/dist/js/modern/prettyInstructions.js +0 -79
- package/dist/js/modern/printBuildError.js +0 -40
- package/dist/js/modern/readTsConfig.js +0 -13
- package/dist/js/modern/removeSlash.js +0 -3
- package/dist/js/modern/runtimeExports.js +0 -52
- package/dist/js/modern/wait.js +0 -5
- package/dist/js/modern/watch.js +0 -43
- package/dist/js/node/FileSizeReporter.js +0 -175
- package/dist/js/node/alias.js +0 -97
- package/dist/js/node/applyOptionsChain.js +0 -37
- package/dist/js/node/chalk.js +0 -15
- package/dist/js/node/clearConsole.js +0 -14
- package/dist/js/node/compatRequire.js +0 -41
- package/dist/js/node/constants.js +0 -353
- package/dist/js/node/debug.js +0 -19
- package/dist/js/node/emptyDir.js +0 -18
- package/dist/js/node/ensureAbsolutePath.js +0 -20
- package/dist/js/node/findExists.js +0 -27
- package/dist/js/node/format.js +0 -141
- package/dist/js/node/generateMetaTags.js +0 -58
- package/dist/js/node/getBrowserslist.js +0 -17
- package/dist/js/node/getCacheIdentifier.js +0 -27
- package/dist/js/node/getEntryOptions.js +0 -35
- package/dist/js/node/getPackageManager.js +0 -51
- package/dist/js/node/getPort.js +0 -67
- package/dist/js/node/import.js +0 -19
- package/dist/js/node/index.js +0 -465
- package/dist/js/node/is/index.js +0 -150
- package/dist/js/node/is/node-env.js +0 -23
- package/dist/js/node/is/platform.js +0 -14
- package/dist/js/node/is/type.js +0 -48
- package/dist/js/node/logger.js +0 -162
- package/dist/js/node/nodeEnv.js +0 -45
- package/dist/js/node/path.js +0 -24
- package/dist/js/node/pkgUp.js +0 -15
- package/dist/js/node/prettyInstructions.js +0 -95
- package/dist/js/node/printBuildError.js +0 -52
- package/dist/js/node/readTsConfig.js +0 -28
- package/dist/js/node/removeSlash.js +0 -18
- package/dist/js/node/runtimeExports.js +0 -68
- package/dist/js/node/wait.js +0 -12
- package/dist/js/node/watch.js +0 -61
- package/dist/js/treeshaking/FileSizeReporter.js +0 -185
- package/dist/js/treeshaking/alias.js +0 -72
- package/dist/js/treeshaking/applyOptionsChain.js +0 -31
- package/dist/js/treeshaking/chalk.js +0 -2
- package/dist/js/treeshaking/clearConsole.js +0 -5
- package/dist/js/treeshaking/compatRequire.js +0 -29
- package/dist/js/treeshaking/constants.js +0 -333
- package/dist/js/treeshaking/debug.js +0 -10
- package/dist/js/treeshaking/emptyDir.js +0 -37
- package/dist/js/treeshaking/ensureAbsolutePath.js +0 -11
- package/dist/js/treeshaking/findExists.js +0 -33
- package/dist/js/treeshaking/format.js +0 -167
- package/dist/js/treeshaking/generateMetaTags.js +0 -55
- package/dist/js/treeshaking/getBrowserslist.js +0 -7
- package/dist/js/treeshaking/getCacheIdentifier.js +0 -35
- package/dist/js/treeshaking/getEntryOptions.js +0 -26
- package/dist/js/treeshaking/getPackageManager.js +0 -101
- package/dist/js/treeshaking/getPort.js +0 -103
- package/dist/js/treeshaking/import.js +0 -11
- package/dist/js/treeshaking/index.js +0 -34
- package/dist/js/treeshaking/is/index.js +0 -81
- package/dist/js/treeshaking/is/node-env.js +0 -13
- package/dist/js/treeshaking/is/platform.js +0 -6
- package/dist/js/treeshaking/is/type.js +0 -29
- package/dist/js/treeshaking/logger.js +0 -188
- package/dist/js/treeshaking/nodeEnv.js +0 -108
- package/dist/js/treeshaking/path.js +0 -11
- package/dist/js/treeshaking/pkgUp.js +0 -2
- package/dist/js/treeshaking/prettyInstructions.js +0 -100
- package/dist/js/treeshaking/printBuildError.js +0 -40
- package/dist/js/treeshaking/readTsConfig.js +0 -13
- package/dist/js/treeshaking/removeSlash.js +0 -9
- package/dist/js/treeshaking/runtimeExports.js +0 -61
- package/dist/js/treeshaking/wait.js +0 -8
- package/dist/js/treeshaking/watch.js +0 -112
- package/dist/types/chalk.d.ts +0 -2
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SHARED_DIR = exports.SERVER_RENDER_FUNCTION_NAME = exports.SERVER_DIR = exports.SERVER_BUNDLE_DIRECTORY = exports.ROUTE_SPEC_FILE = exports.PLUGIN_SCHEMAS = exports.MAIN_ENTRY_NAME = exports.LOADABLE_STATS_FILE = exports.LAUNCH_EDITOR_ENDPOINT = exports.INTERNAL_PLUGINS = exports.HMR_SOCK_PATH = exports.ENTRY_NAME_PATTERN = exports.API_DIR = void 0;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* hmr socket connect path
|
|
10
|
-
*/
|
|
11
|
-
const HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
|
12
|
-
/**
|
|
13
|
-
* route specification file
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
exports.HMR_SOCK_PATH = HMR_SOCK_PATH;
|
|
17
|
-
const ROUTE_SPEC_FILE = 'route.json';
|
|
18
|
-
/**
|
|
19
|
-
* main entry name
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
exports.ROUTE_SPEC_FILE = ROUTE_SPEC_FILE;
|
|
23
|
-
const MAIN_ENTRY_NAME = 'main';
|
|
24
|
-
/**
|
|
25
|
-
* open editor request path
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
exports.MAIN_ENTRY_NAME = MAIN_ENTRY_NAME;
|
|
29
|
-
const LAUNCH_EDITOR_ENDPOINT = '/__open-stack-frame-in-editor';
|
|
30
|
-
/**
|
|
31
|
-
* server side bundles directory, which relative to dist.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
exports.LAUNCH_EDITOR_ENDPOINT = LAUNCH_EDITOR_ENDPOINT;
|
|
35
|
-
const SERVER_BUNDLE_DIRECTORY = 'bundles';
|
|
36
|
-
/**
|
|
37
|
-
* entry name pattern used for ajv pattern properties.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
exports.SERVER_BUNDLE_DIRECTORY = SERVER_BUNDLE_DIRECTORY;
|
|
41
|
-
const ENTRY_NAME_PATTERN = '^[a-zA-Z0-9_-]+$';
|
|
42
|
-
/**
|
|
43
|
-
* SSR server render function name
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
exports.ENTRY_NAME_PATTERN = ENTRY_NAME_PATTERN;
|
|
47
|
-
const SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
|
48
|
-
/**
|
|
49
|
-
* loadbale manifest json file
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
exports.SERVER_RENDER_FUNCTION_NAME = SERVER_RENDER_FUNCTION_NAME;
|
|
53
|
-
const LOADABLE_STATS_FILE = 'loadable-stats.json';
|
|
54
|
-
/**
|
|
55
|
-
* internal specified folder
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
exports.LOADABLE_STATS_FILE = LOADABLE_STATS_FILE;
|
|
59
|
-
const API_DIR = 'api';
|
|
60
|
-
exports.API_DIR = API_DIR;
|
|
61
|
-
const SERVER_DIR = 'server';
|
|
62
|
-
exports.SERVER_DIR = SERVER_DIR;
|
|
63
|
-
const SHARED_DIR = 'shared';
|
|
64
|
-
/**
|
|
65
|
-
* Internal plugins that work as soon as they are installed.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
exports.SHARED_DIR = SHARED_DIR;
|
|
69
|
-
const INTERNAL_PLUGINS = {
|
|
70
|
-
'@modern-js/app-tools': {
|
|
71
|
-
cli: '@modern-js/app-tools/cli'
|
|
72
|
-
},
|
|
73
|
-
'@modern-js/monorepo-tools': {
|
|
74
|
-
cli: '@modern-js/monorepo-tools/cli'
|
|
75
|
-
},
|
|
76
|
-
'@modern-js/module-tools': {
|
|
77
|
-
cli: '@modern-js/module-tools/cli'
|
|
78
|
-
},
|
|
79
|
-
'@modern-js/runtime': {
|
|
80
|
-
cli: '@modern-js/runtime/cli'
|
|
81
|
-
},
|
|
82
|
-
'@modern-js/plugin-less': {
|
|
83
|
-
cli: '@modern-js/plugin-less/cli'
|
|
84
|
-
},
|
|
85
|
-
'@modern-js/plugin-sass': {
|
|
86
|
-
cli: '@modern-js/plugin-sass/cli'
|
|
87
|
-
},
|
|
88
|
-
'@modern-js/plugin-esbuild': {
|
|
89
|
-
cli: '@modern-js/plugin-esbuild/cli'
|
|
90
|
-
},
|
|
91
|
-
'@modern-js/plugin-proxy': {
|
|
92
|
-
cli: '@modern-js/plugin-proxy/cli'
|
|
93
|
-
},
|
|
94
|
-
'@modern-js/plugin-ssg': {
|
|
95
|
-
cli: '@modern-js/plugin-ssg/cli'
|
|
96
|
-
},
|
|
97
|
-
'@modern-js/plugin-bff': {
|
|
98
|
-
cli: '@modern-js/plugin-bff/cli',
|
|
99
|
-
server: '@modern-js/plugin-bff/server'
|
|
100
|
-
},
|
|
101
|
-
'@modern-js/plugin-electron': {
|
|
102
|
-
cli: '@modern-js/plugin-electron/cli'
|
|
103
|
-
},
|
|
104
|
-
'@modern-js/plugin-testing': {
|
|
105
|
-
cli: '@modern-js/plugin-testing/cli'
|
|
106
|
-
},
|
|
107
|
-
'@modern-js/plugin-storybook': {
|
|
108
|
-
cli: '@modern-js/plugin-storybook/cli'
|
|
109
|
-
},
|
|
110
|
-
'@modern-js/plugin-docsite': {
|
|
111
|
-
cli: '@modern-js/plugin-docsite/cli'
|
|
112
|
-
},
|
|
113
|
-
'@modern-js/plugin-express': {
|
|
114
|
-
cli: '@modern-js/plugin-express/cli',
|
|
115
|
-
server: '@modern-js/plugin-express'
|
|
116
|
-
},
|
|
117
|
-
'@modern-js/plugin-egg': {
|
|
118
|
-
cli: '@modern-js/plugin-egg/cli',
|
|
119
|
-
server: '@modern-js/plugin-egg'
|
|
120
|
-
},
|
|
121
|
-
'@modern-js/plugin-koa': {
|
|
122
|
-
cli: '@modern-js/plugin-koa/cli',
|
|
123
|
-
server: '@modern-js/plugin-koa'
|
|
124
|
-
},
|
|
125
|
-
'@modern-js/plugin-nest': {
|
|
126
|
-
cli: '@modern-js/plugin-nest/cli',
|
|
127
|
-
server: '@modern-js/plugin-nest/server'
|
|
128
|
-
},
|
|
129
|
-
'@modern-js/plugin-unbundle': {
|
|
130
|
-
cli: '@modern-js/plugin-unbundle'
|
|
131
|
-
},
|
|
132
|
-
'@modern-js/plugin-server-build': {
|
|
133
|
-
cli: '@modern-js/plugin-server-build'
|
|
134
|
-
},
|
|
135
|
-
'@modern-js/plugin-server': {
|
|
136
|
-
cli: '@modern-js/plugin-server/cli',
|
|
137
|
-
server: '@modern-js/plugin-server/server'
|
|
138
|
-
},
|
|
139
|
-
'@modern-js/plugin-garfish': {
|
|
140
|
-
cli: '@modern-js/plugin-garfish/cli'
|
|
141
|
-
},
|
|
142
|
-
'@modern-js/plugin-jarvis': {
|
|
143
|
-
cli: '@modern-js/plugin-jarvis/cli'
|
|
144
|
-
},
|
|
145
|
-
'@modern-js/plugin-tailwindcss': {
|
|
146
|
-
cli: '@modern-js/plugin-tailwindcss/cli'
|
|
147
|
-
},
|
|
148
|
-
'@modern-js/plugin-lambda-fc': {
|
|
149
|
-
cli: '@modern-js/plugin-lambda-fc/cli'
|
|
150
|
-
},
|
|
151
|
-
'@modern-js/plugin-lambda-scf': {
|
|
152
|
-
cli: '@modern-js/plugin-lambda-scf/cli'
|
|
153
|
-
},
|
|
154
|
-
'@modern-js/plugin-cdn-oss': {
|
|
155
|
-
cli: '@modern-js/plugin-cdn-oss/cli'
|
|
156
|
-
},
|
|
157
|
-
'@modern-js/plugin-cdn-cos': {
|
|
158
|
-
cli: '@modern-js/plugin-cdn-cos/cli'
|
|
159
|
-
},
|
|
160
|
-
'@modern-js/plugin-static-hosting': {
|
|
161
|
-
cli: '@modern-js/plugin-static-hosting/cli'
|
|
162
|
-
},
|
|
163
|
-
'@modern-js/plugin-polyfill': {
|
|
164
|
-
cli: '@modern-js/plugin-polyfill/cli',
|
|
165
|
-
server: '@modern-js/plugin-polyfill'
|
|
166
|
-
},
|
|
167
|
-
'@modern-js/plugin-multiprocess': {
|
|
168
|
-
cli: '@modern-js/plugin-multiprocess/cli'
|
|
169
|
-
},
|
|
170
|
-
'@modern-js/plugin-nocode': {
|
|
171
|
-
cli: '@modern-js/plugin-nocode/cli'
|
|
172
|
-
},
|
|
173
|
-
'@modern-js/plugin-design-token': {
|
|
174
|
-
cli: '@modern-js/plugin-design-token/cli'
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* The schema registered in the plugin.
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
exports.INTERNAL_PLUGINS = INTERNAL_PLUGINS;
|
|
182
|
-
const PLUGIN_SCHEMAS = {
|
|
183
|
-
'@modern-js/runtime': [{
|
|
184
|
-
target: 'runtime',
|
|
185
|
-
schema: {
|
|
186
|
-
type: 'object',
|
|
187
|
-
additionalProperties: false
|
|
188
|
-
}
|
|
189
|
-
}, {
|
|
190
|
-
target: 'runtimeByEntries',
|
|
191
|
-
schema: {
|
|
192
|
-
type: 'object',
|
|
193
|
-
patternProperties: {
|
|
194
|
-
[ENTRY_NAME_PATTERN]: {
|
|
195
|
-
type: 'object'
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
additionalProperties: false
|
|
199
|
-
}
|
|
200
|
-
}],
|
|
201
|
-
'@modern-js/plugin-bff': [{
|
|
202
|
-
target: 'bff',
|
|
203
|
-
schema: {
|
|
204
|
-
type: 'object',
|
|
205
|
-
properties: {
|
|
206
|
-
prefix: {
|
|
207
|
-
type: ['string', 'array'],
|
|
208
|
-
items: {
|
|
209
|
-
type: 'string'
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
fetcher: {
|
|
213
|
-
type: 'string'
|
|
214
|
-
},
|
|
215
|
-
proxy: {
|
|
216
|
-
type: 'object'
|
|
217
|
-
},
|
|
218
|
-
requestCreator: {
|
|
219
|
-
type: 'string'
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}],
|
|
224
|
-
'@modern-js/plugin-esbuild': [{
|
|
225
|
-
target: 'tools.esbuild',
|
|
226
|
-
schema: {
|
|
227
|
-
typeof: ['object']
|
|
228
|
-
}
|
|
229
|
-
}],
|
|
230
|
-
'@modern-js/plugin-less': [{
|
|
231
|
-
target: 'tools.less',
|
|
232
|
-
schema: {
|
|
233
|
-
typeof: ['object', 'function']
|
|
234
|
-
}
|
|
235
|
-
}],
|
|
236
|
-
'@modern-js/plugin-sass': [{
|
|
237
|
-
target: 'tools.sass',
|
|
238
|
-
schema: {
|
|
239
|
-
typeof: ['object', 'function']
|
|
240
|
-
}
|
|
241
|
-
}],
|
|
242
|
-
'@modern-js/plugin-tailwindcss': [{
|
|
243
|
-
target: 'tools.tailwindcss',
|
|
244
|
-
schema: {
|
|
245
|
-
typeof: ['object', 'function']
|
|
246
|
-
}
|
|
247
|
-
}],
|
|
248
|
-
'@modern-js/plugin-proxy': [{
|
|
249
|
-
target: 'dev.proxy',
|
|
250
|
-
schema: {
|
|
251
|
-
typeof: ['string', 'object']
|
|
252
|
-
}
|
|
253
|
-
}],
|
|
254
|
-
'@modern-js/plugin-unbundle': [{
|
|
255
|
-
target: 'output.disableAutoImportStyle',
|
|
256
|
-
schema: {
|
|
257
|
-
type: 'boolean'
|
|
258
|
-
}
|
|
259
|
-
}, {
|
|
260
|
-
target: 'dev.unbundle',
|
|
261
|
-
schema: {
|
|
262
|
-
type: 'object',
|
|
263
|
-
properties: {
|
|
264
|
-
ignore: {
|
|
265
|
-
type: ['string', 'array'],
|
|
266
|
-
items: {
|
|
267
|
-
type: 'string'
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
ignoreModuleCache: {
|
|
271
|
-
type: 'boolean'
|
|
272
|
-
},
|
|
273
|
-
clearPdnCache: {
|
|
274
|
-
type: 'boolean'
|
|
275
|
-
},
|
|
276
|
-
pdnHost: {
|
|
277
|
-
type: 'string'
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}],
|
|
282
|
-
'@modern-js/plugin-ssg': [{
|
|
283
|
-
target: 'output.ssg',
|
|
284
|
-
schema: {
|
|
285
|
-
oneOf: [{
|
|
286
|
-
type: 'boolean'
|
|
287
|
-
}, {
|
|
288
|
-
type: 'object'
|
|
289
|
-
}, {
|
|
290
|
-
instanceof: 'Function'
|
|
291
|
-
}]
|
|
292
|
-
}
|
|
293
|
-
}],
|
|
294
|
-
'@modern-js/plugin-ssr': [{
|
|
295
|
-
target: 'runtime.ssr',
|
|
296
|
-
schema: {
|
|
297
|
-
type: ['boolean', 'object']
|
|
298
|
-
}
|
|
299
|
-
}],
|
|
300
|
-
'@modern-js/plugin-state': [{
|
|
301
|
-
target: 'runtime.state',
|
|
302
|
-
schema: {
|
|
303
|
-
type: ['boolean', 'object']
|
|
304
|
-
}
|
|
305
|
-
}],
|
|
306
|
-
'@modern-js/plugin-design-token': [// Legacy Features
|
|
307
|
-
{
|
|
308
|
-
target: 'source.designSystem',
|
|
309
|
-
schema: {
|
|
310
|
-
typeof: ['object']
|
|
311
|
-
}
|
|
312
|
-
}, {
|
|
313
|
-
target: 'source.designSystem.supportStyledComponents',
|
|
314
|
-
schema: {
|
|
315
|
-
type: ['boolean']
|
|
316
|
-
}
|
|
317
|
-
}],
|
|
318
|
-
'@modern-js/plugin-router': [{
|
|
319
|
-
target: 'runtime.router',
|
|
320
|
-
schema: {
|
|
321
|
-
type: ['boolean', 'object']
|
|
322
|
-
}
|
|
323
|
-
}],
|
|
324
|
-
'@modern-js/plugin-testing': [{
|
|
325
|
-
target: 'testing',
|
|
326
|
-
schema: {
|
|
327
|
-
typeof: ['object']
|
|
328
|
-
}
|
|
329
|
-
}, {
|
|
330
|
-
target: 'tools.jest',
|
|
331
|
-
schema: {
|
|
332
|
-
typeof: ['object', 'function']
|
|
333
|
-
}
|
|
334
|
-
}],
|
|
335
|
-
'@modern-js/plugin-garfish': [{
|
|
336
|
-
target: 'runtime.masterApp',
|
|
337
|
-
schema: {
|
|
338
|
-
type: ['boolean', 'object']
|
|
339
|
-
}
|
|
340
|
-
}, {
|
|
341
|
-
target: 'dev.withMasterApp',
|
|
342
|
-
schema: {
|
|
343
|
-
type: ['object']
|
|
344
|
-
}
|
|
345
|
-
}, {
|
|
346
|
-
target: 'deploy.microFrontend',
|
|
347
|
-
schema: {
|
|
348
|
-
type: ['boolean', 'object']
|
|
349
|
-
}
|
|
350
|
-
}],
|
|
351
|
-
'@modern-js/plugin-nocode': []
|
|
352
|
-
};
|
|
353
|
-
exports.PLUGIN_SCHEMAS = PLUGIN_SCHEMAS;
|
package/dist/js/node/debug.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createDebugger = void 0;
|
|
7
|
-
|
|
8
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Create debug function with unified namespace prefix.
|
|
14
|
-
* @param scope - Custom module name of your debug function.
|
|
15
|
-
* @returns Debug function which namespace start with modern-js:.
|
|
16
|
-
*/
|
|
17
|
-
const createDebugger = scope => (0, _debug.default)(`modern-js:${scope}`);
|
|
18
|
-
|
|
19
|
-
exports.createDebugger = createDebugger;
|
package/dist/js/node/emptyDir.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.emptyDir = void 0;
|
|
7
|
-
|
|
8
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const emptyDir = async dir => {
|
|
13
|
-
if (await _fsExtra.default.pathExists(dir)) {
|
|
14
|
-
await _fsExtra.default.emptyDir(dir);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.emptyDir = emptyDir;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ensureAbsolutePath = void 0;
|
|
7
|
-
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* ensure absolute file path.
|
|
14
|
-
* @param base - Base path to resolve relative from.
|
|
15
|
-
* @param filePath - Aboluste or relative file path.
|
|
16
|
-
* @returns Resolved absolute file path.
|
|
17
|
-
*/
|
|
18
|
-
const ensureAbsolutePath = (base, filePath) => _path.default.isAbsolute(filePath) ? filePath : _path.default.resolve(base, filePath);
|
|
19
|
-
|
|
20
|
-
exports.ensureAbsolutePath = ensureAbsolutePath;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findExists = void 0;
|
|
7
|
-
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Find first already exists file.
|
|
14
|
-
* @param files - Asbolute file paths with extension.
|
|
15
|
-
* @returns The file path if exists, or false if no file exists.
|
|
16
|
-
*/
|
|
17
|
-
const findExists = files => {
|
|
18
|
-
for (const file of files) {
|
|
19
|
-
if (_fs.default.existsSync(file) && _fs.default.statSync(file).isFile()) {
|
|
20
|
-
return file;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return false;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
exports.findExists = findExists;
|
package/dist/js/node/format.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatProxyOptions = formatProxyOptions;
|
|
7
|
-
exports.formatWebpackMessages = formatWebpackMessages;
|
|
8
|
-
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
|
|
13
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
-
|
|
15
|
-
/* eslint-disable no-param-reassign */
|
|
16
|
-
|
|
17
|
-
/* eslint-disable max-statements */
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the MIT license found in the
|
|
23
|
-
* LICENSE file at
|
|
24
|
-
* https://github.com/facebook/create-react-app/blob/master/LICENSE
|
|
25
|
-
*/
|
|
26
|
-
// Modified by Chao Xu (xuchaobei)
|
|
27
|
-
const friendlySyntaxErrorLabel = 'Syntax error:';
|
|
28
|
-
|
|
29
|
-
function isLikelyASyntaxError(message) {
|
|
30
|
-
return message.includes(friendlySyntaxErrorLabel);
|
|
31
|
-
} // Cleans up webpack error messages.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function formatMessage(message) {
|
|
35
|
-
var _lines$;
|
|
36
|
-
|
|
37
|
-
let lines = []; // webpack 5 stats error object
|
|
38
|
-
|
|
39
|
-
if (typeof message === 'object') {
|
|
40
|
-
message = `${message.moduleName && `${message.moduleName}\n`}${message.details || message.stack || message.message}`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
lines = message.split('\n'); // Strip webpack-added headers off errors/warnings
|
|
44
|
-
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
|
45
|
-
|
|
46
|
-
lines = lines.filter(line => !/Module [A-z ]+\(from/.test(line)); // Transform parsing error into syntax error
|
|
47
|
-
|
|
48
|
-
lines = lines.map(line => {
|
|
49
|
-
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
|
|
50
|
-
|
|
51
|
-
if (!parsingError) {
|
|
52
|
-
return line;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
56
|
-
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
57
|
-
});
|
|
58
|
-
message = lines.join('\n'); // Smoosh syntax errors (commonly found in CSS)
|
|
59
|
-
|
|
60
|
-
message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
|
|
61
|
-
lines = message.split('\n'); // Remove leading newline
|
|
62
|
-
|
|
63
|
-
if (lines.length > 2 && lines[1].trim() === '') {
|
|
64
|
-
lines.splice(1, 1);
|
|
65
|
-
} // Clean up file name
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1'); // Cleans up verbose "module not found" messages for files and packages.
|
|
69
|
-
|
|
70
|
-
if ((_lines$ = lines[1]) !== null && _lines$ !== void 0 && _lines$.startsWith('Module not found: ')) {
|
|
71
|
-
lines = [lines[0], lines[1].replace('Error: ', '').replace('Module not found: Cannot find file:', 'Cannot find file:').replace('[CaseSensitivePathsPlugin] ', '').replace("Cannot resolve 'file' or 'directory' ", '')];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
message = lines.join('\n'); // Internal stacks are generally useless so we strip them... with the
|
|
75
|
-
// exception of stacks containing `webpack:` because they're normally
|
|
76
|
-
// from user code generated by webpack. For more information see
|
|
77
|
-
// https://github.com/facebook/create-react-app/pull/1050
|
|
78
|
-
|
|
79
|
-
message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
|
|
80
|
-
|
|
81
|
-
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
|
|
82
|
-
|
|
83
|
-
lines = message.split('\n'); // Remove duplicated newlines
|
|
84
|
-
|
|
85
|
-
lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()); // Reassemble the message
|
|
86
|
-
|
|
87
|
-
message = lines.join('\n');
|
|
88
|
-
return message.trim();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function formatWebpackMessages(json) {
|
|
92
|
-
var _json$errors, _json$warnings, _result$errors;
|
|
93
|
-
|
|
94
|
-
const formattedErrors = (_json$errors = json.errors) === null || _json$errors === void 0 ? void 0 : _json$errors.map(formatMessage);
|
|
95
|
-
const formattedWarnings = (_json$warnings = json.warnings) === null || _json$warnings === void 0 ? void 0 : _json$warnings.map(formatMessage);
|
|
96
|
-
const result = {
|
|
97
|
-
errors: formattedErrors || [],
|
|
98
|
-
warnings: formattedWarnings || []
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
if ((_result$errors = result.errors) !== null && _result$errors !== void 0 && _result$errors.some(isLikelyASyntaxError)) {
|
|
102
|
-
// If there are any syntax errors, show just them.
|
|
103
|
-
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
104
|
-
} // First error is usually it.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (result.errors.length > 1) {
|
|
108
|
-
result.errors.length = 1;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/* eslint-enable max-statements */
|
|
115
|
-
|
|
116
|
-
/* eslint-enable no-param-reassign */
|
|
117
|
-
function formatProxyOptions(proxyOptions) {
|
|
118
|
-
const formatedProxy = [];
|
|
119
|
-
|
|
120
|
-
if (!Array.isArray(proxyOptions)) {
|
|
121
|
-
if ('target' in proxyOptions) {
|
|
122
|
-
formatedProxy.push(proxyOptions);
|
|
123
|
-
} else {
|
|
124
|
-
Array.prototype.push.apply(formatedProxy, Object.keys(proxyOptions).reduce((total, source) => {
|
|
125
|
-
const option = proxyOptions[source];
|
|
126
|
-
total.push(_objectSpread({
|
|
127
|
-
context: source,
|
|
128
|
-
changeOrigin: true,
|
|
129
|
-
logLevel: 'warn'
|
|
130
|
-
}, typeof option === 'string' ? {
|
|
131
|
-
target: option
|
|
132
|
-
} : option));
|
|
133
|
-
return total;
|
|
134
|
-
}, []));
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
formatedProxy.push(...proxyOptions);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return formatedProxy;
|
|
141
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateMetaTags = void 0;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Copyright JS Foundation and other contributors.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file at
|
|
13
|
-
* https://github.com/jantimon/html-webpack-plugin/blob/main/LICENSE
|
|
14
|
-
*
|
|
15
|
-
* Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90db28d4/index.js#L800
|
|
16
|
-
*/
|
|
17
|
-
const tagObjectToString = tagDefinition => {
|
|
18
|
-
const attributes = Object.keys(tagDefinition.attributes || {}).filter(attributeName => tagDefinition.attributes[attributeName] !== false).map(attributeName => {
|
|
19
|
-
if (tagDefinition.attributes[attributeName] === true) {
|
|
20
|
-
return attributeName;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
|
|
24
|
-
});
|
|
25
|
-
return `<${[tagDefinition.tagName].concat(attributes).join(' ')}>${tagDefinition.innerHTML || ''}${tagDefinition.voidTag ? '' : `</${tagDefinition.tagName}>`}`;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const generateMetaTags = metaOptions => {
|
|
29
|
-
if (!metaOptions) {
|
|
30
|
-
return '';
|
|
31
|
-
} // Make tags self-closing in case of xhtml
|
|
32
|
-
// Turn { "viewport" : "width=500, initial-scale=1" } into
|
|
33
|
-
// [{ name:"viewport" content:"width=500, initial-scale=1" }]
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const metaTagAttributeObjects = Object.keys(metaOptions).map(metaName => {
|
|
37
|
-
const metaTagContent = metaOptions[metaName];
|
|
38
|
-
return typeof metaTagContent === 'string' ? {
|
|
39
|
-
name: metaName,
|
|
40
|
-
content: metaTagContent
|
|
41
|
-
} : metaTagContent;
|
|
42
|
-
}).filter(attribute => attribute !== false); // Turn [{ name:"viewport" content:"width=500, initial-scale=1" }] into
|
|
43
|
-
// the html-webpack-plugin tag structure
|
|
44
|
-
|
|
45
|
-
return metaTagAttributeObjects.map(metaTagAttributes => {
|
|
46
|
-
if (metaTagAttributes === false) {
|
|
47
|
-
throw new Error('Invalid meta tag');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
tagName: 'meta',
|
|
52
|
-
voidTag: true,
|
|
53
|
-
attributes: metaTagAttributes
|
|
54
|
-
};
|
|
55
|
-
}).reduce((memo, tagObject) => `${memo}\n${tagObjectToString(tagObject)}`, '');
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
exports.generateMetaTags = generateMetaTags;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getBrowserslist = exports.defaults = void 0;
|
|
7
|
-
|
|
8
|
-
var _browserslist = require("browserslist");
|
|
9
|
-
|
|
10
|
-
const defaults = ['> 0.01%', 'not dead', 'not op_mini all'];
|
|
11
|
-
exports.defaults = defaults;
|
|
12
|
-
|
|
13
|
-
const getBrowserslist = appDirectory => (0, _browserslist.loadConfig)({
|
|
14
|
-
path: appDirectory
|
|
15
|
-
}) || defaults;
|
|
16
|
-
|
|
17
|
-
exports.getBrowserslist = getBrowserslist;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCacheIdentifier = getCacheIdentifier;
|
|
7
|
-
|
|
8
|
-
var _is = require("./is");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Generate cache identifier from some packages and config files.
|
|
12
|
-
*/
|
|
13
|
-
function getCacheIdentifier(packages, _files) {
|
|
14
|
-
/* eslint-disable no-nested-ternary */
|
|
15
|
-
let cacheIdentifier = (0, _is.isProd)() ? 'production' : (0, _is.isDev)() ? 'development' : (0, _is.isTest)() ? 'test' : '';
|
|
16
|
-
/* eslint-enable no-nested-ternary */
|
|
17
|
-
|
|
18
|
-
for (const {
|
|
19
|
-
name,
|
|
20
|
-
version
|
|
21
|
-
} of packages) {
|
|
22
|
-
cacheIdentifier += `:${name}@${version}`;
|
|
23
|
-
} // TODO: config file hash
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return cacheIdentifier;
|
|
27
|
-
}
|