@modern-js/utils 1.3.7 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,219 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* hmr socket connect path
|
3
|
-
*/
|
4
|
-
export declare const HMR_SOCK_PATH = "/_modern_js_hmr_ws";
|
5
|
-
/**
|
6
|
-
* route specification file
|
7
|
-
*/
|
8
|
-
|
9
|
-
export declare const ROUTE_SPEC_FILE = "route.json";
|
10
|
-
/**
|
11
|
-
* main entry name
|
12
|
-
*/
|
13
|
-
|
14
|
-
export declare const MAIN_ENTRY_NAME = "main";
|
15
|
-
/**
|
16
|
-
* open editor request path
|
17
|
-
*/
|
18
|
-
|
19
|
-
export declare const LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
|
20
|
-
/**
|
21
|
-
* server side bundles directory, which relative to dist.
|
22
|
-
*/
|
23
|
-
|
24
|
-
export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
|
25
|
-
/**
|
26
|
-
* entry name pattern used for ajv pattern properties.
|
27
|
-
*/
|
28
|
-
|
29
|
-
export declare const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
30
|
-
/**
|
31
|
-
* SSR server render function name
|
32
|
-
*/
|
33
|
-
|
34
|
-
export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
35
|
-
/**
|
36
|
-
* loadbale manifest json file
|
37
|
-
*/
|
38
|
-
|
39
|
-
export declare const LOADABLE_STATS_FILE = "loadable-stats.json";
|
40
|
-
/**
|
41
|
-
* internal specified folder
|
42
|
-
*/
|
43
|
-
|
44
|
-
export declare const API_DIR = "api";
|
45
|
-
export declare const SERVER_DIR = "server";
|
46
|
-
export declare const SHARED_DIR = "shared";
|
47
|
-
/**
|
48
|
-
* Internal plugins that work as soon as they are installed.
|
49
|
-
*/
|
50
|
-
|
51
|
-
export declare const INTERNAL_PLUGINS: {
|
52
|
-
[name: string]: {
|
53
|
-
cli?: string;
|
54
|
-
server?: string;
|
55
|
-
};
|
56
|
-
};
|
57
|
-
/**
|
58
|
-
* The schema registered in the plugin.
|
59
|
-
*/
|
60
|
-
|
61
|
-
export declare const PLUGIN_SCHEMAS: {
|
62
|
-
'@modern-js/runtime': ({
|
63
|
-
target: string;
|
64
|
-
schema: {
|
65
|
-
type: string;
|
66
|
-
additionalProperties: boolean;
|
67
|
-
patternProperties?: undefined;
|
68
|
-
};
|
69
|
-
} | {
|
70
|
-
target: string;
|
71
|
-
schema: {
|
72
|
-
type: string;
|
73
|
-
patternProperties: {
|
74
|
-
"^[a-zA-Z0-9_-]+$": {
|
75
|
-
type: string;
|
76
|
-
};
|
77
|
-
};
|
78
|
-
additionalProperties: boolean;
|
79
|
-
};
|
80
|
-
})[];
|
81
|
-
'@modern-js/plugin-bff': {
|
82
|
-
target: string;
|
83
|
-
schema: {
|
84
|
-
type: string;
|
85
|
-
properties: {
|
86
|
-
prefix: {
|
87
|
-
type: string[];
|
88
|
-
items: {
|
89
|
-
type: string;
|
90
|
-
};
|
91
|
-
};
|
92
|
-
fetcher: {
|
93
|
-
type: string;
|
94
|
-
};
|
95
|
-
proxy: {
|
96
|
-
type: string;
|
97
|
-
};
|
98
|
-
requestCreator: {
|
99
|
-
type: string;
|
100
|
-
};
|
101
|
-
};
|
102
|
-
};
|
103
|
-
}[];
|
104
|
-
'@modern-js/plugin-esbuild': {
|
105
|
-
target: string;
|
106
|
-
schema: {
|
107
|
-
typeof: string[];
|
108
|
-
};
|
109
|
-
}[];
|
110
|
-
'@modern-js/plugin-less': {
|
111
|
-
target: string;
|
112
|
-
schema: {
|
113
|
-
typeof: string[];
|
114
|
-
};
|
115
|
-
}[];
|
116
|
-
'@modern-js/plugin-sass': {
|
117
|
-
target: string;
|
118
|
-
schema: {
|
119
|
-
typeof: string[];
|
120
|
-
};
|
121
|
-
}[];
|
122
|
-
'@modern-js/plugin-tailwindcss': {
|
123
|
-
target: string;
|
124
|
-
schema: {
|
125
|
-
typeof: string[];
|
126
|
-
};
|
127
|
-
}[];
|
128
|
-
'@modern-js/plugin-proxy': {
|
129
|
-
target: string;
|
130
|
-
schema: {
|
131
|
-
typeof: string[];
|
132
|
-
};
|
133
|
-
}[];
|
134
|
-
'@modern-js/plugin-unbundle': ({
|
135
|
-
target: string;
|
136
|
-
schema: {
|
137
|
-
type: string;
|
138
|
-
properties?: undefined;
|
139
|
-
};
|
140
|
-
} | {
|
141
|
-
target: string;
|
142
|
-
schema: {
|
143
|
-
type: string;
|
144
|
-
properties: {
|
145
|
-
ignore: {
|
146
|
-
type: string[];
|
147
|
-
items: {
|
148
|
-
type: string;
|
149
|
-
};
|
150
|
-
};
|
151
|
-
ignoreModuleCache: {
|
152
|
-
type: string;
|
153
|
-
};
|
154
|
-
clearPdnCache: {
|
155
|
-
type: string;
|
156
|
-
};
|
157
|
-
pdnHost: {
|
158
|
-
type: string;
|
159
|
-
};
|
160
|
-
};
|
161
|
-
};
|
162
|
-
})[];
|
163
|
-
'@modern-js/plugin-ssg': {
|
164
|
-
target: string;
|
165
|
-
schema: {
|
166
|
-
oneOf: ({
|
167
|
-
type: string;
|
168
|
-
instanceof?: undefined;
|
169
|
-
} | {
|
170
|
-
instanceof: string;
|
171
|
-
type?: undefined;
|
172
|
-
})[];
|
173
|
-
};
|
174
|
-
}[];
|
175
|
-
'@modern-js/plugin-ssr': {
|
176
|
-
target: string;
|
177
|
-
schema: {
|
178
|
-
type: string[];
|
179
|
-
};
|
180
|
-
}[];
|
181
|
-
'@modern-js/plugin-state': {
|
182
|
-
target: string;
|
183
|
-
schema: {
|
184
|
-
type: string[];
|
185
|
-
};
|
186
|
-
}[];
|
187
|
-
'@modern-js/plugin-design-token': ({
|
188
|
-
target: string;
|
189
|
-
schema: {
|
190
|
-
typeof: string[];
|
191
|
-
type?: undefined;
|
192
|
-
};
|
193
|
-
} | {
|
194
|
-
target: string;
|
195
|
-
schema: {
|
196
|
-
type: string[];
|
197
|
-
typeof?: undefined;
|
198
|
-
};
|
199
|
-
})[];
|
200
|
-
'@modern-js/plugin-router': {
|
201
|
-
target: string;
|
202
|
-
schema: {
|
203
|
-
type: string[];
|
204
|
-
};
|
205
|
-
}[];
|
206
|
-
'@modern-js/plugin-testing': {
|
207
|
-
target: string;
|
208
|
-
schema: {
|
209
|
-
typeof: string[];
|
210
|
-
};
|
211
|
-
}[];
|
212
|
-
'@modern-js/plugin-garfish': {
|
213
|
-
target: string;
|
214
|
-
schema: {
|
215
|
-
type: string[];
|
216
|
-
};
|
217
|
-
}[];
|
218
|
-
'@modern-js/plugin-nocode': never[];
|
219
|
-
};
|
package/dist/types/debug.d.ts
DELETED
@@ -1,8 +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 declare const createDebugger: (scope: string) => debug.Debugger;
|
package/dist/types/emptyDir.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export declare const emptyDir: (dir: string) => Promise<void>;
|
package/dist/types/logger.d.ts
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
import { Color } from 'chalk';
|
2
|
-
declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
3
|
-
interface LoggerConfiguration {
|
4
|
-
color?: typeof Color;
|
5
|
-
label?: string;
|
6
|
-
level?: LogLevel;
|
7
|
-
}
|
8
|
-
interface InstanceConfiguration {
|
9
|
-
displayLabel?: boolean;
|
10
|
-
underlineLabel?: boolean;
|
11
|
-
uppercaseLabel?: boolean;
|
12
|
-
}
|
13
|
-
interface ConstructorOptions {
|
14
|
-
config?: InstanceConfiguration;
|
15
|
-
types?: Record<string, LoggerConfiguration>;
|
16
|
-
}
|
17
|
-
declare type LoggerFunction = (message?: number | string | Error, ...args: any[]) => void;
|
18
|
-
declare const LOG_TYPES: {
|
19
|
-
error: {
|
20
|
-
color: string;
|
21
|
-
label: string;
|
22
|
-
level: string;
|
23
|
-
};
|
24
|
-
info: {
|
25
|
-
color: string;
|
26
|
-
label: string;
|
27
|
-
level: string;
|
28
|
-
};
|
29
|
-
warn: {
|
30
|
-
color: string;
|
31
|
-
label: string;
|
32
|
-
level: string;
|
33
|
-
};
|
34
|
-
debug: {
|
35
|
-
color: string;
|
36
|
-
label: string;
|
37
|
-
level: string;
|
38
|
-
};
|
39
|
-
log: {
|
40
|
-
level: string;
|
41
|
-
};
|
42
|
-
};
|
43
|
-
|
44
|
-
declare class Logger {
|
45
|
-
private readonly logCount;
|
46
|
-
private history;
|
47
|
-
private readonly config;
|
48
|
-
private readonly types;
|
49
|
-
private readonly longestLabel;
|
50
|
-
[key: string]: any;
|
51
|
-
constructor(options?: ConstructorOptions);
|
52
|
-
private retainLog;
|
53
|
-
private _log;
|
54
|
-
private getLongestLabel;
|
55
|
-
private get longestUnderlinedLabel();
|
56
|
-
getRetainedLogs(type: string): string[];
|
57
|
-
clearRetainedLogs(type: string): void;
|
58
|
-
}
|
59
|
-
|
60
|
-
declare type LoggerInterface = { [key in keyof typeof LOG_TYPES]: LoggerFunction };
|
61
|
-
declare const logger: Logger & LoggerInterface;
|
62
|
-
export { logger };
|
63
|
-
export type { LoggerInterface };
|
package/dist/types/pkgUp.d.ts
DELETED
package/tests/.eslintrc.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`prettyInstructions The src directory does not exist 1`] = `
|
4
|
-
"App running at:
|
5
|
-
|
6
|
-
> Network: http://127.0.0.1:8080/api
|
7
|
-
> Network: http://11.11.111.11:8080/api
|
8
|
-
> Network: http://10.100.100.100:8080/api
|
9
|
-
"
|
10
|
-
`;
|
11
|
-
|
12
|
-
exports[`prettyInstructions basic usage 1`] = `
|
13
|
-
"App running at:
|
14
|
-
|
15
|
-
> Network: http://127.0.0.1:8080/
|
16
|
-
> Network: http://11.11.111.11:8080/
|
17
|
-
> Network: http://10.100.100.100:8080/
|
18
|
-
"
|
19
|
-
`;
|
@@ -1,100 +0,0 @@
|
|
1
|
-
import { applyOptionsChain } from '../src/applyOptionsChain';
|
2
|
-
|
3
|
-
describe('apply options chain', () => {
|
4
|
-
test(`should return default options`, () => {
|
5
|
-
expect(applyOptionsChain({ default: 'a' })).toEqual({ default: 'a' });
|
6
|
-
});
|
7
|
-
|
8
|
-
test(`should merge default options`, () => {
|
9
|
-
expect(
|
10
|
-
applyOptionsChain(
|
11
|
-
{ name: 'a' },
|
12
|
-
{
|
13
|
-
name: 'b',
|
14
|
-
custom: 'c',
|
15
|
-
},
|
16
|
-
),
|
17
|
-
).toEqual({
|
18
|
-
name: 'b',
|
19
|
-
custom: 'c',
|
20
|
-
});
|
21
|
-
});
|
22
|
-
|
23
|
-
test(`should support custom merge function`, () => {
|
24
|
-
const merge = (target: any, source: any) => {
|
25
|
-
for (const key in source) {
|
26
|
-
if (target.hasOwnProperty(key)) {
|
27
|
-
target[key] += source[key];
|
28
|
-
} else {
|
29
|
-
target[key] = source[key];
|
30
|
-
}
|
31
|
-
}
|
32
|
-
return target;
|
33
|
-
};
|
34
|
-
|
35
|
-
expect(
|
36
|
-
applyOptionsChain(
|
37
|
-
{
|
38
|
-
a: 1,
|
39
|
-
b: 'b',
|
40
|
-
},
|
41
|
-
{
|
42
|
-
a: 2,
|
43
|
-
b: 'b',
|
44
|
-
c: 'c',
|
45
|
-
},
|
46
|
-
{},
|
47
|
-
merge,
|
48
|
-
),
|
49
|
-
).toEqual({
|
50
|
-
a: 3,
|
51
|
-
b: 'bb',
|
52
|
-
c: 'c',
|
53
|
-
});
|
54
|
-
});
|
55
|
-
|
56
|
-
test(`should support funciton or object array`, () => {
|
57
|
-
const defaults = { a: 'a' };
|
58
|
-
|
59
|
-
const options = [
|
60
|
-
{ b: 'b' },
|
61
|
-
(o: any, { add }: { add: any }) => {
|
62
|
-
o.c = add(1, 2);
|
63
|
-
},
|
64
|
-
(o: any) => ({
|
65
|
-
...o,
|
66
|
-
d: 'd',
|
67
|
-
}),
|
68
|
-
{ e: 'e' },
|
69
|
-
];
|
70
|
-
expect(
|
71
|
-
applyOptionsChain(defaults, options as any, {
|
72
|
-
add: (a: any, b: any) => a + b,
|
73
|
-
}),
|
74
|
-
).toEqual({
|
75
|
-
a: 'a',
|
76
|
-
b: 'b',
|
77
|
-
c: 3,
|
78
|
-
d: 'd',
|
79
|
-
e: 'e',
|
80
|
-
});
|
81
|
-
});
|
82
|
-
|
83
|
-
test(`should throw error`, () => {
|
84
|
-
expect(() => {
|
85
|
-
applyOptionsChain(1, 2);
|
86
|
-
}).toThrow(/^applyOptionsChain error:/);
|
87
|
-
});
|
88
|
-
|
89
|
-
test(`should log warning about function result`, () => {
|
90
|
-
let outputs = '';
|
91
|
-
/* eslint-disable no-console */
|
92
|
-
console.log = jest.fn(input => (outputs += input));
|
93
|
-
/* eslint-enable no-console */
|
94
|
-
applyOptionsChain({ name: 'a' } as any, [() => 111]);
|
95
|
-
|
96
|
-
expect(outputs).toContain(
|
97
|
-
'Function should mutate the config and return nothing, Or return a cloned or merged version of config object.',
|
98
|
-
);
|
99
|
-
});
|
100
|
-
});
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import path from 'path';
|
2
|
-
import { compatRequire, cleanRequireCache } from '../src/compatRequire';
|
3
|
-
|
4
|
-
describe('compat require', () => {
|
5
|
-
const fixturePath = path.resolve(__dirname, './fixtures/compat-require');
|
6
|
-
|
7
|
-
test(`should support default property`, () => {
|
8
|
-
expect(compatRequire(path.join(fixturePath, 'esm.js'))).toEqual({
|
9
|
-
name: 'esm',
|
10
|
-
});
|
11
|
-
});
|
12
|
-
|
13
|
-
test(`should support commonjs module`, () => {
|
14
|
-
expect(compatRequire(path.join(fixturePath, 'cjs.js'))).toEqual({
|
15
|
-
name: 'cjs',
|
16
|
-
});
|
17
|
-
});
|
18
|
-
|
19
|
-
test(`should return null`, () => {
|
20
|
-
expect(compatRequire(path.join(fixturePath, 'empty.js'))).toEqual(null);
|
21
|
-
});
|
22
|
-
|
23
|
-
test('should clearn cache after fn', () => {
|
24
|
-
const foo = module.require('./fixtures/compat-require/foo');
|
25
|
-
const requirePath = require.resolve('./fixtures/compat-require/foo.js');
|
26
|
-
expect(foo.name).toBe('foo');
|
27
|
-
expect(require.cache[requirePath]).toBeDefined();
|
28
|
-
cleanRequireCache([requirePath]);
|
29
|
-
jest.resetModules();
|
30
|
-
expect(require.cache[requirePath]).toBeUndefined();
|
31
|
-
});
|
32
|
-
});
|
package/tests/debug.test.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import debug from 'debug';
|
2
|
-
import stripAnsi from 'strip-ansi';
|
3
|
-
import { createDebugger } from '../src/debug';
|
4
|
-
|
5
|
-
describe('debug utility', () => {
|
6
|
-
test('should return file path', () => {
|
7
|
-
const debug1 = createDebugger('test');
|
8
|
-
|
9
|
-
const debug2 = createDebugger('test2');
|
10
|
-
|
11
|
-
debug.enable('modern-js:test2');
|
12
|
-
|
13
|
-
debug.log = (...args) => {
|
14
|
-
// XXX: args[0] 的内容有时候是 ' \x1B[38;5;167;1mmodern-js:test2 \x1B[0m22222' 这种格式
|
15
|
-
expect(stripAnsi(args[0])).toContain('modern-js:test2 22222');
|
16
|
-
};
|
17
|
-
|
18
|
-
debug1('11111');
|
19
|
-
debug2('22222');
|
20
|
-
|
21
|
-
expect(debug2.enabled).toBe(true);
|
22
|
-
|
23
|
-
expect(debug1.enabled).toBe(false);
|
24
|
-
});
|
25
|
-
});
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import path from 'path';
|
2
|
-
import { ensureAbsolutePath } from '../src/ensureAbsolutePath';
|
3
|
-
|
4
|
-
describe('ensure absolute file path', () => {
|
5
|
-
test('should return filePath directly', () => {
|
6
|
-
expect(
|
7
|
-
path.isAbsolute(ensureAbsolutePath('/a/b', '/a/b/c/d/e.jsx')),
|
8
|
-
).toBeTruthy();
|
9
|
-
});
|
10
|
-
|
11
|
-
test(`should resolve absolute path`, () => {
|
12
|
-
expect(
|
13
|
-
path.isAbsolute(ensureAbsolutePath('/a/b', 'c/d/e.jsx')),
|
14
|
-
).toBeTruthy();
|
15
|
-
});
|
16
|
-
});
|
package/tests/findExists.test.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
import path from 'path';
|
2
|
-
import { findExists } from '../src/findExists';
|
3
|
-
|
4
|
-
describe('find first exists file', () => {
|
5
|
-
const fixturePath = path.resolve(__dirname, './fixtures/file-exists');
|
6
|
-
|
7
|
-
test('should return file path', () => {
|
8
|
-
expect(
|
9
|
-
findExists(
|
10
|
-
['.js', '.ts', '.ejs', '.mjs'].map(ext =>
|
11
|
-
path.join(fixturePath, `a${ext}`),
|
12
|
-
),
|
13
|
-
),
|
14
|
-
).toEqual(path.join(fixturePath, 'a.ts'));
|
15
|
-
});
|
16
|
-
|
17
|
-
test('should return false when no file exists', () => {
|
18
|
-
expect(
|
19
|
-
findExists(['.jsx'].map(ext => path.join(fixturePath, `a${ext}`))),
|
20
|
-
).toBe(false);
|
21
|
-
});
|
22
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = { name: 'cjs' };
|
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = null;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
package/tests/format.test.ts
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
import { formatProxyOptions } from '../src/format';
|
2
|
-
|
3
|
-
describe('test format', () => {
|
4
|
-
it('should format correctly use simply options', async () => {
|
5
|
-
const proxy = {
|
6
|
-
'/simple': `http://localhost`,
|
7
|
-
};
|
8
|
-
|
9
|
-
const options = formatProxyOptions(proxy);
|
10
|
-
expect(options).toEqual([
|
11
|
-
{
|
12
|
-
context: '/simple',
|
13
|
-
changeOrigin: true,
|
14
|
-
logLevel: 'warn',
|
15
|
-
target: 'http://localhost',
|
16
|
-
},
|
17
|
-
]);
|
18
|
-
});
|
19
|
-
|
20
|
-
it('should format correctly use simply options', async () => {
|
21
|
-
const proxy = {
|
22
|
-
'/simple-obj': {
|
23
|
-
target: `http://localhost`,
|
24
|
-
},
|
25
|
-
};
|
26
|
-
const options = formatProxyOptions(proxy);
|
27
|
-
expect(options).toEqual([
|
28
|
-
{
|
29
|
-
context: '/simple-obj',
|
30
|
-
changeOrigin: true,
|
31
|
-
logLevel: 'warn',
|
32
|
-
target: 'http://localhost',
|
33
|
-
},
|
34
|
-
]);
|
35
|
-
});
|
36
|
-
|
37
|
-
it('should format correctly use simply options', async () => {
|
38
|
-
const proxy = {
|
39
|
-
context: '/context',
|
40
|
-
target: `http://localhost`,
|
41
|
-
};
|
42
|
-
const options = formatProxyOptions(proxy);
|
43
|
-
expect(options).toEqual([
|
44
|
-
{ context: '/context', target: 'http://localhost' },
|
45
|
-
]);
|
46
|
-
});
|
47
|
-
|
48
|
-
it('should format correctly use simply options', async () => {
|
49
|
-
const proxy = [
|
50
|
-
{
|
51
|
-
context: '/array',
|
52
|
-
target: `http://localhost`,
|
53
|
-
},
|
54
|
-
];
|
55
|
-
const options = formatProxyOptions(proxy);
|
56
|
-
expect(options).toEqual([
|
57
|
-
{ context: '/array', target: 'http://localhost' },
|
58
|
-
]);
|
59
|
-
});
|
60
|
-
});
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { generateMetaTags } from '../src/generateMetaTags';
|
2
|
-
|
3
|
-
describe('generateMetaTags', () => {
|
4
|
-
it('should return empty string when params is empty', () => {
|
5
|
-
expect(generateMetaTags()).toEqual('');
|
6
|
-
});
|
7
|
-
|
8
|
-
it('should generate meta tag correctly', () => {
|
9
|
-
const options = {
|
10
|
-
foo: {
|
11
|
-
name: 'viewport',
|
12
|
-
content: 'width=500, initial-scale=1',
|
13
|
-
},
|
14
|
-
};
|
15
|
-
expect(generateMetaTags(options).trim()).toEqual(
|
16
|
-
'<meta name="viewport" content="width=500, initial-scale=1">',
|
17
|
-
);
|
18
|
-
});
|
19
|
-
});
|