@modern-js/utils 1.3.7 → 1.5.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 +31 -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/{types/FileSizeReporter.d.ts → FileSizeReporter.d.ts} +5 -5
- package/dist/FileSizeReporter.js +151 -0
- package/dist/{types/alias.d.ts → alias.d.ts} +12 -14
- package/dist/alias.js +62 -0
- package/dist/analyzeProject.d.ts +1 -0
- package/dist/analyzeProject.js +44 -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/{types/compatRequire.d.ts → compatRequire.d.ts} +1 -1
- 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/{types/ensureAbsolutePath.d.ts → ensureAbsolutePath.d.ts} +1 -1
- package/dist/ensureAbsolutePath.js +15 -0
- package/dist/{types/findExists.d.ts → findExists.d.ts} +1 -1
- package/dist/findExists.js +21 -0
- package/dist/{types/format.d.ts → format.d.ts} +3 -3
- package/dist/format.js +113 -0
- package/dist/{types/generateMetaTags.d.ts → generateMetaTags.d.ts} +3 -3
- package/dist/generateMetaTags.js +48 -0
- package/dist/{types/getBrowserslist.d.ts → getBrowserslist.d.ts} +1 -1
- package/dist/getBrowserslist.js +7 -0
- package/dist/{types/getCacheIdentifier.d.ts → getCacheIdentifier.d.ts} +3 -3
- package/dist/getCacheIdentifier.js +24 -0
- package/dist/{types/getEntryOptions.d.ts → getEntryOptions.d.ts} +1 -1
- package/dist/getEntryOptions.js +26 -0
- package/dist/{types/getPackageManager.d.ts → getPackageManager.d.ts} +1 -1
- package/dist/getPackageManager.js +47 -0
- package/dist/{types/getPort.d.ts → getPort.d.ts} +1 -1
- package/dist/getPort.js +62 -0
- package/dist/getServerConfig.d.ts +1 -0
- package/dist/getServerConfig.js +39 -0
- package/dist/{types/import.d.ts → import.d.ts} +2 -2
- package/dist/import.js +10 -0
- package/dist/{types/index.d.ts → index.d.ts} +5 -4
- package/dist/index.js +46 -0
- package/dist/{types/is → is}/index.d.ts +1 -4
- package/dist/is/index.js +82 -0
- package/dist/{types/is → is}/node-env.d.ts +1 -1
- 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/{types/is → is}/type.d.ts +1 -1
- package/dist/is/type.js +38 -0
- package/dist/logger.d.ts +63 -0
- package/dist/logger.js +128 -0
- package/dist/{types/monorepo.d.ts → monorepo.d.ts} +3 -3
- package/dist/monorepo.js +80 -0
- package/dist/{types/nodeEnv.d.ts → nodeEnv.d.ts} +1 -1
- package/dist/nodeEnv.js +49 -0
- package/dist/{types/path.d.ts → path.d.ts} +1 -1
- package/dist/path.js +14 -0
- package/dist/{types/prettyInstructions.d.ts → prettyInstructions.d.ts} +2 -2
- package/dist/prettyInstructions.js +64 -0
- package/dist/{types/printBuildError.d.ts → printBuildError.d.ts} +1 -1
- package/dist/printBuildError.js +43 -0
- package/dist/{types/readTsConfig.d.ts → readTsConfig.d.ts} +1 -1
- package/dist/readTsConfig.js +19 -0
- package/dist/{types/removeSlash.d.ts → removeSlash.d.ts} +1 -1
- package/dist/removeSlash.js +9 -0
- package/dist/{types/runtimeExports.d.ts → runtimeExports.d.ts} +3 -3
- 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/wait.d.ts → wait.d.ts} +1 -1
- package/dist/wait.js +7 -0
- package/dist/{types/watch.d.ts → watch.d.ts} +4 -4
- package/dist/watch.js +64 -0
- package/package.json +55 -37
- 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/ensureAbsolutePath.js +0 -9
- 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 -25
- package/dist/js/modern/logger.js +0 -152
- package/dist/js/modern/monorepo.js +0 -84
- 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 -46
- package/dist/js/node/logger.js +0 -162
- package/dist/js/node/monorepo.js +0 -118
- 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 -27
- package/dist/js/treeshaking/logger.js +0 -188
- package/dist/js/treeshaking/monorepo.js +0 -95
- 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/applyOptionsChain.d.ts +0 -6
- package/dist/types/chalk.d.ts +0 -2
- package/dist/types/clearConsole.d.ts +0 -1
- package/dist/types/constants.d.ts +0 -219
- package/dist/types/debug.d.ts +0 -8
- package/dist/types/emptyDir.d.ts +0 -1
- package/dist/types/is/platform.d.ts +0 -2
- package/dist/types/logger.d.ts +0 -63
- package/dist/types/pkgUp.d.ts +0 -2
- package/tests/.eslintrc.js +0 -6
- package/tests/__snapshots__/prettyInstructions.test.ts.snap +0 -19
- package/tests/applyOptionsChain.test.ts +0 -100
- package/tests/compatRequire.test.ts +0 -32
- package/tests/debug.test.ts +0 -25
- package/tests/ensureAbsolutePath.test.ts +0 -16
- package/tests/findExists.test.ts +0 -22
- package/tests/fixtures/browserlist/develop/package.json +0 -11
- package/tests/fixtures/browserlist/dotfile/.browserslistrc +0 -3
- package/tests/fixtures/browserlist/pkg/package.json +0 -7
- package/tests/fixtures/compat-require/cjs.js +0 -1
- package/tests/fixtures/compat-require/empty.js +0 -1
- package/tests/fixtures/compat-require/esm.js +0 -5
- package/tests/fixtures/compat-require/foo.js +0 -3
- package/tests/fixtures/file-exists/a.ejs +0 -0
- package/tests/fixtures/file-exists/a.js/.gitkeep +0 -0
- package/tests/fixtures/file-exists/a.mjs +0 -0
- package/tests/fixtures/file-exists/a.ts +0 -0
- package/tests/format.test.ts +0 -60
- package/tests/generateMetaTags.test.ts +0 -19
- package/tests/getBrowserslist.test.ts +0 -32
- package/tests/getCacheIdentifier.test.ts +0 -37
- package/tests/getEntryOptions.test.ts +0 -53
- package/tests/index.test.ts +0 -18
- package/tests/is.test.ts +0 -27
- package/tests/isPlatform.test.ts +0 -19
- package/tests/isType.test.ts +0 -85
- package/tests/logger.test.ts +0 -53
- package/tests/prettyInstructions.test.ts +0 -139
- package/tests/removeSlash.test.ts +0 -19
- package/tests/tsconfig.json +0 -11
- package/tests/wait.ts +0 -38
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
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; }
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* hmr socket connect path
|
|
5
|
-
*/
|
|
6
|
-
export var HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
|
7
|
-
/**
|
|
8
|
-
* route specification file
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export var ROUTE_SPEC_FILE = 'route.json';
|
|
12
|
-
/**
|
|
13
|
-
* main entry name
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export var MAIN_ENTRY_NAME = 'main';
|
|
17
|
-
/**
|
|
18
|
-
* open editor request path
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export var LAUNCH_EDITOR_ENDPOINT = '/__open-stack-frame-in-editor';
|
|
22
|
-
/**
|
|
23
|
-
* server side bundles directory, which relative to dist.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
export var SERVER_BUNDLE_DIRECTORY = 'bundles';
|
|
27
|
-
/**
|
|
28
|
-
* entry name pattern used for ajv pattern properties.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
export var ENTRY_NAME_PATTERN = '^[a-zA-Z0-9_-]+$';
|
|
32
|
-
/**
|
|
33
|
-
* SSR server render function name
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
export var SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
|
37
|
-
/**
|
|
38
|
-
* loadbale manifest json file
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
export var LOADABLE_STATS_FILE = 'loadable-stats.json';
|
|
42
|
-
/**
|
|
43
|
-
* internal specified folder
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
export var API_DIR = 'api';
|
|
47
|
-
export var SERVER_DIR = 'server';
|
|
48
|
-
export var SHARED_DIR = 'shared';
|
|
49
|
-
/**
|
|
50
|
-
* Internal plugins that work as soon as they are installed.
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
export var INTERNAL_PLUGINS = {
|
|
54
|
-
'@modern-js/app-tools': {
|
|
55
|
-
cli: '@modern-js/app-tools/cli'
|
|
56
|
-
},
|
|
57
|
-
'@modern-js/monorepo-tools': {
|
|
58
|
-
cli: '@modern-js/monorepo-tools/cli'
|
|
59
|
-
},
|
|
60
|
-
'@modern-js/module-tools': {
|
|
61
|
-
cli: '@modern-js/module-tools/cli'
|
|
62
|
-
},
|
|
63
|
-
'@modern-js/runtime': {
|
|
64
|
-
cli: '@modern-js/runtime/cli'
|
|
65
|
-
},
|
|
66
|
-
'@modern-js/plugin-less': {
|
|
67
|
-
cli: '@modern-js/plugin-less/cli'
|
|
68
|
-
},
|
|
69
|
-
'@modern-js/plugin-sass': {
|
|
70
|
-
cli: '@modern-js/plugin-sass/cli'
|
|
71
|
-
},
|
|
72
|
-
'@modern-js/plugin-esbuild': {
|
|
73
|
-
cli: '@modern-js/plugin-esbuild/cli'
|
|
74
|
-
},
|
|
75
|
-
'@modern-js/plugin-proxy': {
|
|
76
|
-
cli: '@modern-js/plugin-proxy/cli'
|
|
77
|
-
},
|
|
78
|
-
'@modern-js/plugin-ssg': {
|
|
79
|
-
cli: '@modern-js/plugin-ssg/cli'
|
|
80
|
-
},
|
|
81
|
-
'@modern-js/plugin-bff': {
|
|
82
|
-
cli: '@modern-js/plugin-bff/cli',
|
|
83
|
-
server: '@modern-js/plugin-bff/server'
|
|
84
|
-
},
|
|
85
|
-
'@modern-js/plugin-electron': {
|
|
86
|
-
cli: '@modern-js/plugin-electron/cli'
|
|
87
|
-
},
|
|
88
|
-
'@modern-js/plugin-testing': {
|
|
89
|
-
cli: '@modern-js/plugin-testing/cli'
|
|
90
|
-
},
|
|
91
|
-
'@modern-js/plugin-storybook': {
|
|
92
|
-
cli: '@modern-js/plugin-storybook/cli'
|
|
93
|
-
},
|
|
94
|
-
'@modern-js/plugin-docsite': {
|
|
95
|
-
cli: '@modern-js/plugin-docsite/cli'
|
|
96
|
-
},
|
|
97
|
-
'@modern-js/plugin-express': {
|
|
98
|
-
cli: '@modern-js/plugin-express/cli',
|
|
99
|
-
server: '@modern-js/plugin-express'
|
|
100
|
-
},
|
|
101
|
-
'@modern-js/plugin-egg': {
|
|
102
|
-
cli: '@modern-js/plugin-egg/cli',
|
|
103
|
-
server: '@modern-js/plugin-egg'
|
|
104
|
-
},
|
|
105
|
-
'@modern-js/plugin-koa': {
|
|
106
|
-
cli: '@modern-js/plugin-koa/cli',
|
|
107
|
-
server: '@modern-js/plugin-koa'
|
|
108
|
-
},
|
|
109
|
-
'@modern-js/plugin-nest': {
|
|
110
|
-
cli: '@modern-js/plugin-nest/cli',
|
|
111
|
-
server: '@modern-js/plugin-nest/server'
|
|
112
|
-
},
|
|
113
|
-
'@modern-js/plugin-unbundle': {
|
|
114
|
-
cli: '@modern-js/plugin-unbundle'
|
|
115
|
-
},
|
|
116
|
-
'@modern-js/plugin-server-build': {
|
|
117
|
-
cli: '@modern-js/plugin-server-build'
|
|
118
|
-
},
|
|
119
|
-
'@modern-js/plugin-server': {
|
|
120
|
-
cli: '@modern-js/plugin-server/cli',
|
|
121
|
-
server: '@modern-js/plugin-server/server'
|
|
122
|
-
},
|
|
123
|
-
'@modern-js/plugin-garfish': {
|
|
124
|
-
cli: '@modern-js/plugin-garfish/cli'
|
|
125
|
-
},
|
|
126
|
-
'@modern-js/plugin-jarvis': {
|
|
127
|
-
cli: '@modern-js/plugin-jarvis/cli'
|
|
128
|
-
},
|
|
129
|
-
'@modern-js/plugin-tailwindcss': {
|
|
130
|
-
cli: '@modern-js/plugin-tailwindcss/cli'
|
|
131
|
-
},
|
|
132
|
-
'@modern-js/plugin-lambda-fc': {
|
|
133
|
-
cli: '@modern-js/plugin-lambda-fc/cli'
|
|
134
|
-
},
|
|
135
|
-
'@modern-js/plugin-lambda-scf': {
|
|
136
|
-
cli: '@modern-js/plugin-lambda-scf/cli'
|
|
137
|
-
},
|
|
138
|
-
'@modern-js/plugin-cdn-oss': {
|
|
139
|
-
cli: '@modern-js/plugin-cdn-oss/cli'
|
|
140
|
-
},
|
|
141
|
-
'@modern-js/plugin-cdn-cos': {
|
|
142
|
-
cli: '@modern-js/plugin-cdn-cos/cli'
|
|
143
|
-
},
|
|
144
|
-
'@modern-js/plugin-static-hosting': {
|
|
145
|
-
cli: '@modern-js/plugin-static-hosting/cli'
|
|
146
|
-
},
|
|
147
|
-
'@modern-js/plugin-polyfill': {
|
|
148
|
-
cli: '@modern-js/plugin-polyfill/cli',
|
|
149
|
-
server: '@modern-js/plugin-polyfill'
|
|
150
|
-
},
|
|
151
|
-
'@modern-js/plugin-multiprocess': {
|
|
152
|
-
cli: '@modern-js/plugin-multiprocess/cli'
|
|
153
|
-
},
|
|
154
|
-
'@modern-js/plugin-nocode': {
|
|
155
|
-
cli: '@modern-js/plugin-nocode/cli'
|
|
156
|
-
},
|
|
157
|
-
'@modern-js/plugin-design-token': {
|
|
158
|
-
cli: '@modern-js/plugin-design-token/cli'
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* The schema registered in the plugin.
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
export var PLUGIN_SCHEMAS = {
|
|
166
|
-
'@modern-js/runtime': [{
|
|
167
|
-
target: 'runtime',
|
|
168
|
-
schema: {
|
|
169
|
-
type: 'object',
|
|
170
|
-
additionalProperties: false
|
|
171
|
-
}
|
|
172
|
-
}, {
|
|
173
|
-
target: 'runtimeByEntries',
|
|
174
|
-
schema: {
|
|
175
|
-
type: 'object',
|
|
176
|
-
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
177
|
-
type: 'object'
|
|
178
|
-
}),
|
|
179
|
-
additionalProperties: false
|
|
180
|
-
}
|
|
181
|
-
}],
|
|
182
|
-
'@modern-js/plugin-bff': [{
|
|
183
|
-
target: 'bff',
|
|
184
|
-
schema: {
|
|
185
|
-
type: 'object',
|
|
186
|
-
properties: {
|
|
187
|
-
prefix: {
|
|
188
|
-
type: ['string', 'array'],
|
|
189
|
-
items: {
|
|
190
|
-
type: 'string'
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
fetcher: {
|
|
194
|
-
type: 'string'
|
|
195
|
-
},
|
|
196
|
-
proxy: {
|
|
197
|
-
type: 'object'
|
|
198
|
-
},
|
|
199
|
-
requestCreator: {
|
|
200
|
-
type: 'string'
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}],
|
|
205
|
-
'@modern-js/plugin-esbuild': [{
|
|
206
|
-
target: 'tools.esbuild',
|
|
207
|
-
schema: {
|
|
208
|
-
"typeof": ['object']
|
|
209
|
-
}
|
|
210
|
-
}],
|
|
211
|
-
'@modern-js/plugin-less': [{
|
|
212
|
-
target: 'tools.less',
|
|
213
|
-
schema: {
|
|
214
|
-
"typeof": ['object', 'function']
|
|
215
|
-
}
|
|
216
|
-
}],
|
|
217
|
-
'@modern-js/plugin-sass': [{
|
|
218
|
-
target: 'tools.sass',
|
|
219
|
-
schema: {
|
|
220
|
-
"typeof": ['object', 'function']
|
|
221
|
-
}
|
|
222
|
-
}],
|
|
223
|
-
'@modern-js/plugin-tailwindcss': [{
|
|
224
|
-
target: 'tools.tailwindcss',
|
|
225
|
-
schema: {
|
|
226
|
-
"typeof": ['object', 'function']
|
|
227
|
-
}
|
|
228
|
-
}],
|
|
229
|
-
'@modern-js/plugin-proxy': [{
|
|
230
|
-
target: 'dev.proxy',
|
|
231
|
-
schema: {
|
|
232
|
-
"typeof": ['string', 'object']
|
|
233
|
-
}
|
|
234
|
-
}],
|
|
235
|
-
'@modern-js/plugin-unbundle': [{
|
|
236
|
-
target: 'output.disableAutoImportStyle',
|
|
237
|
-
schema: {
|
|
238
|
-
type: 'boolean'
|
|
239
|
-
}
|
|
240
|
-
}, {
|
|
241
|
-
target: 'dev.unbundle',
|
|
242
|
-
schema: {
|
|
243
|
-
type: 'object',
|
|
244
|
-
properties: {
|
|
245
|
-
ignore: {
|
|
246
|
-
type: ['string', 'array'],
|
|
247
|
-
items: {
|
|
248
|
-
type: 'string'
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
ignoreModuleCache: {
|
|
252
|
-
type: 'boolean'
|
|
253
|
-
},
|
|
254
|
-
clearPdnCache: {
|
|
255
|
-
type: 'boolean'
|
|
256
|
-
},
|
|
257
|
-
pdnHost: {
|
|
258
|
-
type: 'string'
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}],
|
|
263
|
-
'@modern-js/plugin-ssg': [{
|
|
264
|
-
target: 'output.ssg',
|
|
265
|
-
schema: {
|
|
266
|
-
oneOf: [{
|
|
267
|
-
type: 'boolean'
|
|
268
|
-
}, {
|
|
269
|
-
type: 'object'
|
|
270
|
-
}, {
|
|
271
|
-
"instanceof": 'Function'
|
|
272
|
-
}]
|
|
273
|
-
}
|
|
274
|
-
}],
|
|
275
|
-
'@modern-js/plugin-ssr': [{
|
|
276
|
-
target: 'runtime.ssr',
|
|
277
|
-
schema: {
|
|
278
|
-
type: ['boolean', 'object']
|
|
279
|
-
}
|
|
280
|
-
}],
|
|
281
|
-
'@modern-js/plugin-state': [{
|
|
282
|
-
target: 'runtime.state',
|
|
283
|
-
schema: {
|
|
284
|
-
type: ['boolean', 'object']
|
|
285
|
-
}
|
|
286
|
-
}],
|
|
287
|
-
'@modern-js/plugin-design-token': [// Legacy Features
|
|
288
|
-
{
|
|
289
|
-
target: 'source.designSystem',
|
|
290
|
-
schema: {
|
|
291
|
-
"typeof": ['object']
|
|
292
|
-
}
|
|
293
|
-
}, {
|
|
294
|
-
target: 'source.designSystem.supportStyledComponents',
|
|
295
|
-
schema: {
|
|
296
|
-
type: ['boolean']
|
|
297
|
-
}
|
|
298
|
-
}],
|
|
299
|
-
'@modern-js/plugin-router': [{
|
|
300
|
-
target: 'runtime.router',
|
|
301
|
-
schema: {
|
|
302
|
-
type: ['boolean', 'object']
|
|
303
|
-
}
|
|
304
|
-
}],
|
|
305
|
-
'@modern-js/plugin-testing': [{
|
|
306
|
-
target: 'testing',
|
|
307
|
-
schema: {
|
|
308
|
-
"typeof": ['object']
|
|
309
|
-
}
|
|
310
|
-
}, {
|
|
311
|
-
target: 'tools.jest',
|
|
312
|
-
schema: {
|
|
313
|
-
"typeof": ['object', 'function']
|
|
314
|
-
}
|
|
315
|
-
}],
|
|
316
|
-
'@modern-js/plugin-garfish': [{
|
|
317
|
-
target: 'runtime.masterApp',
|
|
318
|
-
schema: {
|
|
319
|
-
type: ['boolean', 'object']
|
|
320
|
-
}
|
|
321
|
-
}, {
|
|
322
|
-
target: 'dev.withMasterApp',
|
|
323
|
-
schema: {
|
|
324
|
-
type: ['object']
|
|
325
|
-
}
|
|
326
|
-
}, {
|
|
327
|
-
target: 'deploy.microFrontend',
|
|
328
|
-
schema: {
|
|
329
|
-
type: ['boolean', 'object']
|
|
330
|
-
}
|
|
331
|
-
}],
|
|
332
|
-
'@modern-js/plugin-nocode': []
|
|
333
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import debug from 'debug';
|
|
2
|
-
/**
|
|
3
|
-
* Create debug function with unified namespace prefix.
|
|
4
|
-
* @param scope - Custom module name of your debug function.
|
|
5
|
-
* @returns Debug function which namespace start with modern-js:.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export var createDebugger = function createDebugger(scope) {
|
|
9
|
-
return debug("modern-js:".concat(scope));
|
|
10
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
-
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
|
|
5
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
-
|
|
7
|
-
import fs from 'fs-extra';
|
|
8
|
-
export var emptyDir = /*#__PURE__*/function () {
|
|
9
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(dir) {
|
|
10
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
-
while (1) {
|
|
12
|
-
switch (_context.prev = _context.next) {
|
|
13
|
-
case 0:
|
|
14
|
-
_context.next = 2;
|
|
15
|
-
return fs.pathExists(dir);
|
|
16
|
-
|
|
17
|
-
case 2:
|
|
18
|
-
if (!_context.sent) {
|
|
19
|
-
_context.next = 5;
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_context.next = 5;
|
|
24
|
-
return fs.emptyDir(dir);
|
|
25
|
-
|
|
26
|
-
case 5:
|
|
27
|
-
case "end":
|
|
28
|
-
return _context.stop();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}, _callee);
|
|
32
|
-
}));
|
|
33
|
-
|
|
34
|
-
return function emptyDir(_x) {
|
|
35
|
-
return _ref.apply(this, arguments);
|
|
36
|
-
};
|
|
37
|
-
}();
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
/**
|
|
3
|
-
* ensure absolute file path.
|
|
4
|
-
* @param base - Base path to resolve relative from.
|
|
5
|
-
* @param filePath - Aboluste or relative file path.
|
|
6
|
-
* @returns Resolved absolute file path.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export var ensureAbsolutePath = function ensureAbsolutePath(base, filePath) {
|
|
10
|
-
return path.isAbsolute(filePath) ? filePath : path.resolve(base, filePath);
|
|
11
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
2
|
-
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
|
|
5
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6
|
-
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
/**
|
|
9
|
-
* Find first already exists file.
|
|
10
|
-
* @param files - Asbolute file paths with extension.
|
|
11
|
-
* @returns The file path if exists, or false if no file exists.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export var findExists = function findExists(files) {
|
|
15
|
-
var _iterator = _createForOfIteratorHelper(files),
|
|
16
|
-
_step;
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20
|
-
var file = _step.value;
|
|
21
|
-
|
|
22
|
-
if (fs.existsSync(file) && fs.statSync(file).isFile()) {
|
|
23
|
-
return file;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
} catch (err) {
|
|
27
|
-
_iterator.e(err);
|
|
28
|
-
} finally {
|
|
29
|
-
_iterator.f();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return false;
|
|
33
|
-
};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
-
|
|
17
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
|
|
19
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
-
|
|
21
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
|
-
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
24
|
-
|
|
25
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
-
|
|
27
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
28
|
-
|
|
29
|
-
/* eslint-disable no-param-reassign */
|
|
30
|
-
|
|
31
|
-
/* eslint-disable max-statements */
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the MIT license found in the
|
|
37
|
-
* LICENSE file at
|
|
38
|
-
* https://github.com/facebook/create-react-app/blob/master/LICENSE
|
|
39
|
-
*/
|
|
40
|
-
// Modified by Chao Xu (xuchaobei)
|
|
41
|
-
var friendlySyntaxErrorLabel = 'Syntax error:';
|
|
42
|
-
|
|
43
|
-
function isLikelyASyntaxError(message) {
|
|
44
|
-
return message.includes(friendlySyntaxErrorLabel);
|
|
45
|
-
} // Cleans up webpack error messages.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function formatMessage(message) {
|
|
49
|
-
var _lines$;
|
|
50
|
-
|
|
51
|
-
var lines = []; // webpack 5 stats error object
|
|
52
|
-
|
|
53
|
-
if (_typeof(message) === 'object') {
|
|
54
|
-
message = "".concat(message.moduleName && "".concat(message.moduleName, "\n")).concat(message.details || message.stack || message.message);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
lines = message.split('\n'); // Strip webpack-added headers off errors/warnings
|
|
58
|
-
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
|
59
|
-
|
|
60
|
-
lines = lines.filter(function (line) {
|
|
61
|
-
return !/Module [A-z ]+\(from/.test(line);
|
|
62
|
-
}); // Transform parsing error into syntax error
|
|
63
|
-
|
|
64
|
-
lines = lines.map(function (line) {
|
|
65
|
-
var parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
|
|
66
|
-
|
|
67
|
-
if (!parsingError) {
|
|
68
|
-
return line;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var _parsingError = _slicedToArray(parsingError, 4),
|
|
72
|
-
errorLine = _parsingError[1],
|
|
73
|
-
errorColumn = _parsingError[2],
|
|
74
|
-
errorMessage = _parsingError[3];
|
|
75
|
-
|
|
76
|
-
return "".concat(friendlySyntaxErrorLabel, " ").concat(errorMessage, " (").concat(errorLine, ":").concat(errorColumn, ")");
|
|
77
|
-
});
|
|
78
|
-
message = lines.join('\n'); // Smoosh syntax errors (commonly found in CSS)
|
|
79
|
-
|
|
80
|
-
message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, "".concat(friendlySyntaxErrorLabel, " $3 ($1:$2)\n"));
|
|
81
|
-
lines = message.split('\n'); // Remove leading newline
|
|
82
|
-
|
|
83
|
-
if (lines.length > 2 && lines[1].trim() === '') {
|
|
84
|
-
lines.splice(1, 1);
|
|
85
|
-
} // Clean up file name
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1'); // Cleans up verbose "module not found" messages for files and packages.
|
|
89
|
-
|
|
90
|
-
if ((_lines$ = lines[1]) !== null && _lines$ !== void 0 && _lines$.startsWith('Module not found: ')) {
|
|
91
|
-
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' ", '')];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
message = lines.join('\n'); // Internal stacks are generally useless so we strip them... with the
|
|
95
|
-
// exception of stacks containing `webpack:` because they're normally
|
|
96
|
-
// from user code generated by webpack. For more information see
|
|
97
|
-
// https://github.com/facebook/create-react-app/pull/1050
|
|
98
|
-
|
|
99
|
-
message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
|
|
100
|
-
|
|
101
|
-
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
|
|
102
|
-
|
|
103
|
-
lines = message.split('\n'); // Remove duplicated newlines
|
|
104
|
-
|
|
105
|
-
lines = lines.filter(function (line, index, arr) {
|
|
106
|
-
return index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim();
|
|
107
|
-
}); // Reassemble the message
|
|
108
|
-
|
|
109
|
-
message = lines.join('\n');
|
|
110
|
-
return message.trim();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function formatWebpackMessages(json) {
|
|
114
|
-
var _json$errors, _json$warnings, _result$errors;
|
|
115
|
-
|
|
116
|
-
var formattedErrors = (_json$errors = json.errors) === null || _json$errors === void 0 ? void 0 : _json$errors.map(formatMessage);
|
|
117
|
-
var formattedWarnings = (_json$warnings = json.warnings) === null || _json$warnings === void 0 ? void 0 : _json$warnings.map(formatMessage);
|
|
118
|
-
var result = {
|
|
119
|
-
errors: formattedErrors || [],
|
|
120
|
-
warnings: formattedWarnings || []
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
if ((_result$errors = result.errors) !== null && _result$errors !== void 0 && _result$errors.some(isLikelyASyntaxError)) {
|
|
124
|
-
// If there are any syntax errors, show just them.
|
|
125
|
-
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
126
|
-
} // First error is usually it.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (result.errors.length > 1) {
|
|
130
|
-
result.errors.length = 1;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return result;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export { formatWebpackMessages };
|
|
137
|
-
/* eslint-enable max-statements */
|
|
138
|
-
|
|
139
|
-
/* eslint-enable no-param-reassign */
|
|
140
|
-
|
|
141
|
-
function formatProxyOptions(proxyOptions) {
|
|
142
|
-
var formatedProxy = [];
|
|
143
|
-
|
|
144
|
-
if (!Array.isArray(proxyOptions)) {
|
|
145
|
-
if ('target' in proxyOptions) {
|
|
146
|
-
formatedProxy.push(proxyOptions);
|
|
147
|
-
} else {
|
|
148
|
-
Array.prototype.push.apply(formatedProxy, Object.keys(proxyOptions).reduce(function (total, source) {
|
|
149
|
-
var option = proxyOptions[source];
|
|
150
|
-
total.push(_objectSpread({
|
|
151
|
-
context: source,
|
|
152
|
-
changeOrigin: true,
|
|
153
|
-
logLevel: 'warn'
|
|
154
|
-
}, typeof option === 'string' ? {
|
|
155
|
-
target: option
|
|
156
|
-
} : option));
|
|
157
|
-
return total;
|
|
158
|
-
}, []));
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
formatedProxy.push.apply(formatedProxy, _toConsumableArray(proxyOptions));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return formatedProxy;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export { formatProxyOptions };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright JS Foundation and other contributors.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file at
|
|
6
|
-
* https://github.com/jantimon/html-webpack-plugin/blob/main/LICENSE
|
|
7
|
-
*
|
|
8
|
-
* Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90db28d4/index.js#L800
|
|
9
|
-
*/
|
|
10
|
-
var tagObjectToString = function tagObjectToString(tagDefinition) {
|
|
11
|
-
var attributes = Object.keys(tagDefinition.attributes || {}).filter(function (attributeName) {
|
|
12
|
-
return tagDefinition.attributes[attributeName] !== false;
|
|
13
|
-
}).map(function (attributeName) {
|
|
14
|
-
if (tagDefinition.attributes[attributeName] === true) {
|
|
15
|
-
return attributeName;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return "".concat(attributeName, "=\"").concat(tagDefinition.attributes[attributeName], "\"");
|
|
19
|
-
});
|
|
20
|
-
return "<".concat([tagDefinition.tagName].concat(attributes).join(' '), ">").concat(tagDefinition.innerHTML || '').concat(tagDefinition.voidTag ? '' : "</".concat(tagDefinition.tagName, ">"));
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export var generateMetaTags = function generateMetaTags(metaOptions) {
|
|
24
|
-
if (!metaOptions) {
|
|
25
|
-
return '';
|
|
26
|
-
} // Make tags self-closing in case of xhtml
|
|
27
|
-
// Turn { "viewport" : "width=500, initial-scale=1" } into
|
|
28
|
-
// [{ name:"viewport" content:"width=500, initial-scale=1" }]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var metaTagAttributeObjects = Object.keys(metaOptions).map(function (metaName) {
|
|
32
|
-
var metaTagContent = metaOptions[metaName];
|
|
33
|
-
return typeof metaTagContent === 'string' ? {
|
|
34
|
-
name: metaName,
|
|
35
|
-
content: metaTagContent
|
|
36
|
-
} : metaTagContent;
|
|
37
|
-
}).filter(function (attribute) {
|
|
38
|
-
return attribute !== false;
|
|
39
|
-
}); // Turn [{ name:"viewport" content:"width=500, initial-scale=1" }] into
|
|
40
|
-
// the html-webpack-plugin tag structure
|
|
41
|
-
|
|
42
|
-
return metaTagAttributeObjects.map(function (metaTagAttributes) {
|
|
43
|
-
if (metaTagAttributes === false) {
|
|
44
|
-
throw new Error('Invalid meta tag');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
tagName: 'meta',
|
|
49
|
-
voidTag: true,
|
|
50
|
-
attributes: metaTagAttributes
|
|
51
|
-
};
|
|
52
|
-
}).reduce(function (memo, tagObject) {
|
|
53
|
-
return "".concat(memo, "\n").concat(tagObjectToString(tagObject));
|
|
54
|
-
}, '');
|
|
55
|
-
};
|