@modern-js/utils 2.69.4 → 3.0.0-alpha.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/dist/cjs/cli/alias.js +76 -70
- package/dist/cjs/cli/applyOptionsChain.js +44 -45
- package/dist/cjs/cli/babel.js +100 -119
- package/dist/cjs/cli/commands.js +61 -59
- package/dist/cjs/cli/common.js +45 -37
- package/dist/cjs/cli/config.js +36 -30
- package/dist/cjs/cli/constants.js +124 -161
- package/dist/cjs/cli/ensure.js +52 -45
- package/dist/cjs/cli/fs.js +41 -38
- package/dist/cjs/cli/get/config.js +43 -38
- package/dist/cjs/cli/get/data.js +108 -125
- package/dist/cjs/cli/get/index.js +109 -58
- package/dist/cjs/cli/index.js +202 -63
- package/dist/cjs/cli/is/config.js +75 -71
- package/dist/cjs/cli/is/env.js +49 -37
- package/dist/cjs/cli/is/index.js +76 -25
- package/dist/cjs/cli/is/project.js +139 -135
- package/dist/cjs/cli/is/type.js +65 -49
- package/dist/cjs/cli/logger.js +36 -27
- package/dist/cjs/cli/monorepo.js +100 -96
- package/dist/cjs/cli/package.js +85 -82
- package/dist/cjs/cli/path.js +101 -82
- package/dist/cjs/cli/port.js +71 -74
- package/dist/cjs/cli/prettyInstructions.js +106 -116
- package/dist/cjs/cli/require.js +116 -136
- package/dist/cjs/cli/route.js +67 -77
- package/dist/cjs/cli/runtimeExports.js +16 -70
- package/dist/cjs/cli/version.js +53 -42
- package/dist/cjs/cli/watch.js +79 -72
- package/dist/cjs/compiled.js +199 -128
- package/dist/cjs/import.js +58 -33
- package/dist/cjs/index.js +69 -23
- package/dist/cjs/universal/constants.js +77 -67
- package/dist/cjs/universal/index.js +33 -25
- package/dist/cjs/universal/path.js +33 -27
- package/dist/cjs/universal/pluginDagSort.js +69 -68
- package/dist/compiled/address/index.js +171 -1
- package/dist/compiled/browserslist/index.js +1329 -1
- package/dist/compiled/chalk/index.js +2368 -1
- package/dist/compiled/chokidar/index.js +4138 -16
- package/dist/compiled/chokidar/index.js.LICENSE.txt +41 -0
- package/dist/compiled/commander/index.js +1540 -1
- package/dist/compiled/debug/index.js +621 -1
- package/dist/compiled/dotenv/index.js +101 -1
- package/dist/compiled/dotenv-expand/index.js +54 -1
- package/dist/compiled/execa/index.js +1738 -1
- package/dist/compiled/fast-glob/index.js +4645 -17
- package/dist/compiled/fast-glob/index.js.LICENSE.txt +38 -0
- package/dist/compiled/filesize/index.js +193 -4
- package/dist/compiled/filesize/index.js.LICENSE.txt +7 -0
- package/dist/compiled/fs-extra/index.js +2222 -1
- package/dist/compiled/glob/index.js +2011 -1
- package/dist/compiled/globby/index.js +690 -1
- package/dist/compiled/gzip-size/index.js +157 -1
- package/dist/compiled/import-lazy/index.js +45 -1
- package/dist/compiled/inquirer/index.js +20162 -4
- package/dist/compiled/inquirer/index.js.LICENSE.txt +7 -0
- package/dist/compiled/js-yaml/index.js +2188 -1
- package/dist/compiled/json5/index.js +983 -1
- package/dist/compiled/lodash/index.js +0 -4
- package/dist/compiled/mime-types/index.js +108 -6
- package/dist/compiled/mime-types/index.js.LICENSE.txt +13 -0
- package/dist/compiled/minimist/index.js +202 -1
- package/dist/compiled/nanoid/index.js +83 -1
- package/dist/compiled/ora/index.js +3936 -3
- package/dist/compiled/ora/index.js.LICENSE.txt +1 -0
- package/dist/compiled/pkg-up/index.js +177 -1
- package/dist/compiled/semver/index.js +1779 -1
- package/dist/compiled/signale/index.js +1704 -1
- package/dist/compiled/slash/index.js +32 -1
- package/dist/compiled/strip-ansi/index.js +34 -1
- package/dist/compiled/tsconfig-paths/index.js +629 -1
- package/dist/compiled/upath/index.js +135 -1
- package/dist/compiled/url-join/index.js +61 -1
- package/dist/compiled/webpack-chain/index.js +1475 -1
- package/dist/esm/cli/alias.mjs +31 -0
- package/dist/esm/cli/applyOptionsChain.mjs +16 -0
- package/dist/esm/cli/babel.mjs +76 -0
- package/dist/esm/cli/commands.mjs +23 -0
- package/dist/esm/cli/common.mjs +11 -0
- package/dist/esm/cli/config.mjs +5 -0
- package/dist/esm/cli/constants.mjs +29 -0
- package/dist/esm/cli/ensure.mjs +9 -0
- package/dist/esm/cli/fs.mjs +9 -0
- package/dist/esm/cli/get/config.mjs +14 -0
- package/dist/esm/cli/get/data.mjs +57 -0
- package/dist/esm/cli/get/index.mjs +18 -0
- package/dist/{esm-node/cli/index.js → esm/cli/index.mjs} +0 -1
- package/dist/esm/cli/is/config.mjs +34 -0
- package/dist/esm/cli/is/env.mjs +6 -0
- package/dist/esm/cli/is/project.mjs +104 -0
- package/dist/esm/cli/is/type.mjs +26 -0
- package/dist/esm/cli/logger.mjs +2 -0
- package/dist/esm/cli/monorepo.mjs +50 -0
- package/dist/esm/cli/package.mjs +51 -0
- package/dist/esm/cli/path.mjs +35 -0
- package/dist/esm/cli/port.mjs +35 -0
- package/dist/esm/cli/prettyInstructions.mjs +68 -0
- package/dist/esm/cli/require.mjs +79 -0
- package/dist/esm/cli/route.mjs +36 -0
- package/dist/esm/cli/runtimeExports.mjs +0 -0
- package/dist/esm/cli/version.mjs +21 -0
- package/dist/esm/cli/watch.mjs +40 -0
- package/dist/esm/compiled.mjs +115 -0
- package/dist/esm/import.mjs +25 -0
- package/dist/esm/universal/constants.mjs +13 -0
- package/dist/{esm-node/universal/index.js → esm/universal/index.mjs} +1 -3
- package/dist/esm/universal/path.mjs +2 -0
- package/dist/esm/universal/pluginDagSort.mjs +41 -0
- package/dist/esm-node/cli/alias.mjs +31 -0
- package/dist/esm-node/cli/applyOptionsChain.mjs +16 -0
- package/dist/esm-node/cli/babel.mjs +76 -0
- package/dist/esm-node/cli/commands.mjs +23 -0
- package/dist/esm-node/cli/common.mjs +11 -0
- package/dist/esm-node/cli/config.mjs +5 -0
- package/dist/esm-node/cli/constants.mjs +29 -0
- package/dist/esm-node/cli/ensure.mjs +9 -0
- package/dist/esm-node/cli/fs.mjs +9 -0
- package/dist/esm-node/cli/get/config.mjs +14 -0
- package/dist/esm-node/cli/get/data.mjs +57 -0
- package/dist/esm-node/cli/get/index.mjs +18 -0
- package/dist/esm-node/cli/index.mjs +22 -0
- package/dist/esm-node/cli/is/config.mjs +34 -0
- package/dist/esm-node/cli/is/env.mjs +6 -0
- package/dist/esm-node/cli/is/index.mjs +4 -0
- package/dist/esm-node/cli/is/project.mjs +104 -0
- package/dist/esm-node/cli/is/type.mjs +26 -0
- package/dist/esm-node/cli/logger.mjs +2 -0
- package/dist/esm-node/cli/monorepo.mjs +50 -0
- package/dist/esm-node/cli/package.mjs +51 -0
- package/dist/esm-node/cli/path.mjs +35 -0
- package/dist/esm-node/cli/port.mjs +35 -0
- package/dist/esm-node/cli/prettyInstructions.mjs +68 -0
- package/dist/esm-node/cli/require.mjs +79 -0
- package/dist/esm-node/cli/route.mjs +36 -0
- package/dist/esm-node/cli/runtimeExports.mjs +0 -0
- package/dist/esm-node/cli/version.mjs +21 -0
- package/dist/esm-node/cli/watch.mjs +40 -0
- package/dist/esm-node/compiled.mjs +115 -0
- package/dist/esm-node/import.mjs +25 -0
- package/dist/esm-node/index.mjs +3 -0
- package/dist/esm-node/universal/constants.mjs +13 -0
- package/dist/esm-node/universal/index.mjs +2 -0
- package/dist/esm-node/universal/path.mjs +2 -0
- package/dist/esm-node/universal/pluginDagSort.mjs +41 -0
- package/dist/types/cli/constants.d.ts +2 -26
- package/dist/types/cli/get/data.d.ts +0 -1
- package/dist/types/cli/index.d.ts +0 -1
- package/dist/types/cli/is/config.d.ts +1 -1
- package/dist/types/cli/runtimeExports.d.ts +1 -4
- package/dist/types/cli/watch.d.ts +1 -1
- package/dist/types/compiled.d.ts +0 -5
- package/dist/types/universal/constants.d.ts +4 -7
- package/package.json +28 -57
- package/rslib.config.mts +140 -0
- package/dist/cjs/cli/action.js +0 -55
- package/dist/cjs/universal/formatWebpack.js +0 -127
- package/dist/compiled/react-server-dom-webpack/LICENSE +0 -21
- package/dist/compiled/react-server-dom-webpack/README.md +0 -5
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0 -2552
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +0 -1636
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0 -2708
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +0 -1799
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0 -2751
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +0 -1848
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0 -2714
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +0 -1814
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-node-register.js +0 -69
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +0 -399
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0 -4015
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +0 -3001
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0 -4045
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0 -3003
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0 -4116
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +0 -3113
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0 -4080
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +0 -3080
- package/dist/compiled/react-server-dom-webpack/client.browser.js +0 -7
- package/dist/compiled/react-server-dom-webpack/client.edge.js +0 -7
- package/dist/compiled/react-server-dom-webpack/client.js +0 -3
- package/dist/compiled/react-server-dom-webpack/client.node.js +0 -7
- package/dist/compiled/react-server-dom-webpack/client.node.unbundled.js +0 -7
- package/dist/compiled/react-server-dom-webpack/index.js +0 -12
- package/dist/compiled/react-server-dom-webpack/package.json +0 -111
- package/dist/compiled/react-server-dom-webpack/server.browser.js +0 -17
- package/dist/compiled/react-server-dom-webpack/server.edge.js +0 -17
- package/dist/compiled/react-server-dom-webpack/server.js +0 -6
- package/dist/compiled/react-server-dom-webpack/server.node.js +0 -18
- package/dist/compiled/react-server-dom-webpack/server.node.unbundled.js +0 -18
- package/dist/esm/cli/action.js +0 -68
- package/dist/esm/cli/alias.js +0 -43
- package/dist/esm/cli/applyOptionsChain.js +0 -29
- package/dist/esm/cli/babel.js +0 -122
- package/dist/esm/cli/commands.js +0 -39
- package/dist/esm/cli/common.js +0 -20
- package/dist/esm/cli/config.js +0 -11
- package/dist/esm/cli/constants.js +0 -114
- package/dist/esm/cli/ensure.js +0 -16
- package/dist/esm/cli/fs.js +0 -65
- package/dist/esm/cli/get/config.js +0 -19
- package/dist/esm/cli/get/data.js +0 -143
- package/dist/esm/cli/get/index.js +0 -38
- package/dist/esm/cli/index.js +0 -23
- package/dist/esm/cli/is/config.js +0 -70
- package/dist/esm/cli/is/env.js +0 -22
- package/dist/esm/cli/is/index.js +0 -4
- package/dist/esm/cli/is/project.js +0 -146
- package/dist/esm/cli/is/type.js +0 -39
- package/dist/esm/cli/logger.js +0 -5
- package/dist/esm/cli/monorepo.js +0 -82
- package/dist/esm/cli/package.js +0 -203
- package/dist/esm/cli/path.js +0 -66
- package/dist/esm/cli/port.js +0 -97
- package/dist/esm/cli/prettyInstructions.js +0 -102
- package/dist/esm/cli/require.js +0 -235
- package/dist/esm/cli/route.js +0 -64
- package/dist/esm/cli/runtimeExports.js +0 -44
- package/dist/esm/cli/version.js +0 -26
- package/dist/esm/cli/watch.js +0 -112
- package/dist/esm/compiled.js +0 -66
- package/dist/esm/import.js +0 -11
- package/dist/esm/index.js +0 -3
- package/dist/esm/universal/constants.js +0 -32
- package/dist/esm/universal/formatWebpack.js +0 -95
- package/dist/esm/universal/index.js +0 -4
- package/dist/esm/universal/path.js +0 -6
- package/dist/esm/universal/pluginDagSort.js +0 -73
- package/dist/esm-node/cli/action.js +0 -30
- package/dist/esm-node/cli/alias.js +0 -40
- package/dist/esm-node/cli/applyOptionsChain.js +0 -27
- package/dist/esm-node/cli/babel.js +0 -107
- package/dist/esm-node/cli/commands.js +0 -39
- package/dist/esm-node/cli/common.js +0 -15
- package/dist/esm-node/cli/config.js +0 -9
- package/dist/esm-node/cli/constants.js +0 -114
- package/dist/esm-node/cli/ensure.js +0 -14
- package/dist/esm-node/cli/fs.js +0 -18
- package/dist/esm-node/cli/get/config.js +0 -19
- package/dist/esm-node/cli/get/data.js +0 -96
- package/dist/esm-node/cli/get/index.js +0 -22
- package/dist/esm-node/cli/is/config.js +0 -50
- package/dist/esm-node/cli/is/env.js +0 -12
- package/dist/esm-node/cli/is/project.js +0 -105
- package/dist/esm-node/cli/is/type.js +0 -36
- package/dist/esm-node/cli/logger.js +0 -5
- package/dist/esm-node/cli/monorepo.js +0 -67
- package/dist/esm-node/cli/package.js +0 -66
- package/dist/esm-node/cli/path.js +0 -48
- package/dist/esm-node/cli/port.js +0 -48
- package/dist/esm-node/cli/prettyInstructions.js +0 -90
- package/dist/esm-node/cli/require.js +0 -111
- package/dist/esm-node/cli/route.js +0 -60
- package/dist/esm-node/cli/runtimeExports.js +0 -38
- package/dist/esm-node/cli/version.js +0 -26
- package/dist/esm-node/cli/watch.js +0 -45
- package/dist/esm-node/compiled.js +0 -66
- package/dist/esm-node/import.js +0 -11
- package/dist/esm-node/universal/constants.js +0 -32
- package/dist/esm-node/universal/formatWebpack.js +0 -102
- package/dist/esm-node/universal/path.js +0 -6
- package/dist/esm-node/universal/pluginDagSort.js +0 -50
- package/dist/types/cli/action.d.ts +0 -2
- package/dist/types/universal/formatWebpack.d.ts +0 -26
- /package/dist/{esm-node/cli/is/index.js → esm/cli/is/index.mjs} +0 -0
- /package/dist/{esm-node/index.js → esm/index.mjs} +0 -0
package/package.json
CHANGED
|
@@ -15,15 +15,16 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "
|
|
18
|
+
"version": "3.0.0-alpha.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
22
|
-
"module": "./dist/esm/index.
|
|
22
|
+
"module": "./dist/esm/index.mjs",
|
|
23
23
|
"_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
|
27
|
+
"import": "./dist/esm-node/index.mjs",
|
|
27
28
|
"default": "./dist/cjs/index.js"
|
|
28
29
|
},
|
|
29
30
|
"./logger": {
|
|
@@ -46,22 +47,17 @@
|
|
|
46
47
|
},
|
|
47
48
|
"./universal": {
|
|
48
49
|
"types": "./dist/types/universal/index.d.ts",
|
|
49
|
-
"import": "./dist/esm/universal/index.
|
|
50
|
+
"import": "./dist/esm/universal/index.mjs",
|
|
50
51
|
"default": "./dist/cjs/universal/index.js"
|
|
51
52
|
},
|
|
52
53
|
"./universal/constants": {
|
|
53
54
|
"types": "./dist/types/universal/constants.d.ts",
|
|
54
|
-
"import": "./dist/esm/universal/constants.
|
|
55
|
+
"import": "./dist/esm/universal/constants.mjs",
|
|
55
56
|
"default": "./dist/cjs/universal/constants.js"
|
|
56
57
|
},
|
|
57
|
-
"./universal/format-webpack": {
|
|
58
|
-
"types": "./dist/types/universal/formatWebpack.d.ts",
|
|
59
|
-
"import": "./dist/esm/universal/formatWebpack.js",
|
|
60
|
-
"default": "./dist/cjs/universal/formatWebpack.js"
|
|
61
|
-
},
|
|
62
58
|
"./universal/plugin-dag-sort": {
|
|
63
59
|
"types": "./dist/types/universal/pluginDagSort.d.ts",
|
|
64
|
-
"import": "./dist/esm/universal/pluginDagSort.
|
|
60
|
+
"import": "./dist/esm/universal/pluginDagSort.mjs",
|
|
65
61
|
"default": "./dist/cjs/universal/pluginDagSort.js"
|
|
66
62
|
},
|
|
67
63
|
"./commander": "./dist/compiled/commander/index.js",
|
|
@@ -79,37 +75,7 @@
|
|
|
79
75
|
"./mime-types": "./dist/compiled/mime-types/index.js",
|
|
80
76
|
"./strip-ansi": "./dist/compiled/strip-ansi/index.js",
|
|
81
77
|
"./browserslist": "./dist/compiled/browserslist/index.js",
|
|
82
|
-
"./
|
|
83
|
-
"./tsconfig-paths": "./dist/compiled/tsconfig-paths/index.js",
|
|
84
|
-
"./react-server-dom-webpack": "./dist/compiled/react-server-dom-webpack/index.js",
|
|
85
|
-
"./react-server-dom-webpack/client": {
|
|
86
|
-
"workerd": "./dist/compiled/react-server-dom-webpack/client.edge.js",
|
|
87
|
-
"deno": "./dist/compiled/react-server-dom-webpack/client.edge.js",
|
|
88
|
-
"worker": "./dist/compiled/react-server-dom-webpack/client.edge.js",
|
|
89
|
-
"node": {
|
|
90
|
-
"webpack": "./dist/compiled/react-server-dom-webpack/client.node.js",
|
|
91
|
-
"default": "./dist/compiled/react-server-dom-webpack/client.node.unbundled.js"
|
|
92
|
-
},
|
|
93
|
-
"edge-light": "./dist/compiled/react-server-dom-webpack/client.edge.js",
|
|
94
|
-
"browser": "./dist/compiled/react-server-dom-webpack/client.browser.js",
|
|
95
|
-
"default": "./dist/compiled/react-server-dom-webpack/client.browser.js"
|
|
96
|
-
},
|
|
97
|
-
"./react-server-dom-webpack/client.browser": "./dist/compiled/react-server-dom-webpack/client.browser.js",
|
|
98
|
-
"./react-server-dom-webpack/client.edge": "./dist/compiled/react-server-dom-webpack/client.edge.js",
|
|
99
|
-
"./react-server-dom-webpack/server": {
|
|
100
|
-
"react-server": {
|
|
101
|
-
"workerd": "./dist/compiled/react-server-dom-webpack/server.edge.js",
|
|
102
|
-
"deno": "./dist/compiled/react-server-dom-webpack/server.browser.js",
|
|
103
|
-
"node": {
|
|
104
|
-
"webpack": "./dist/compiled/react-server-dom-webpack/server.node.js",
|
|
105
|
-
"default": "./dist/compiled/react-server-dom-webpack/server.node.unbundled.js"
|
|
106
|
-
},
|
|
107
|
-
"edge-light": "./dist/compiled/react-server-dom-webpack/server.edge.js",
|
|
108
|
-
"browser": "./dist/compiled/react-server-dom-webpack/server.browser.js"
|
|
109
|
-
},
|
|
110
|
-
"default": "./dist/compiled/react-server-dom-webpack/server.js"
|
|
111
|
-
},
|
|
112
|
-
"./react-server-dom-webpack/server.edge": "./dist/compiled/react-server-dom-webpack/server.edge.js"
|
|
78
|
+
"./tsconfig-paths": "./dist/compiled/tsconfig-paths/index.js"
|
|
113
79
|
},
|
|
114
80
|
"publishConfig": {
|
|
115
81
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -135,9 +101,6 @@
|
|
|
135
101
|
"universal/constants": [
|
|
136
102
|
"./dist/types/universal/constants.d.ts"
|
|
137
103
|
],
|
|
138
|
-
"universal/format-webpack": [
|
|
139
|
-
"./dist/types/universal/formatWebpack.d.ts"
|
|
140
|
-
],
|
|
141
104
|
"universal/plugin-dag-sort": [
|
|
142
105
|
"./dist/types/universal/pluginDagSort.d.ts"
|
|
143
106
|
],
|
|
@@ -180,9 +143,6 @@
|
|
|
180
143
|
"browserslist": [
|
|
181
144
|
"./dist/compiled/browserslist/index.d.ts"
|
|
182
145
|
],
|
|
183
|
-
"webpack-chain": [
|
|
184
|
-
"./dist/compiled/webpack-chain/types/index.d.ts"
|
|
185
|
-
],
|
|
186
146
|
"tsconfig-paths": [
|
|
187
147
|
"./dist/compiled/tsconfig-paths/lib/index.d.ts"
|
|
188
148
|
],
|
|
@@ -198,23 +158,34 @@
|
|
|
198
158
|
"@swc/helpers": "^0.5.17",
|
|
199
159
|
"caniuse-lite": "^1.0.30001520",
|
|
200
160
|
"lodash": "^4.17.21",
|
|
201
|
-
"rslog": "^1.
|
|
161
|
+
"rslog": "^1.3.2"
|
|
202
162
|
},
|
|
203
163
|
"devDependencies": {
|
|
204
|
-
"@types/jest": "^29",
|
|
205
|
-
"@types/node": "^
|
|
206
|
-
"jest": "^29",
|
|
164
|
+
"@types/jest": "^29.5.14",
|
|
165
|
+
"@types/node": "^20",
|
|
166
|
+
"jest": "^29.7.0",
|
|
167
|
+
"@rslib/core": "0.18.5",
|
|
207
168
|
"typescript": "^5",
|
|
208
|
-
"
|
|
209
|
-
"@modern-js/
|
|
210
|
-
"@scripts/build": "2.66.0",
|
|
169
|
+
"@modern-js/types": "3.0.0-alpha.0",
|
|
170
|
+
"@modern-js/rslib": "2.68.10",
|
|
211
171
|
"@scripts/jest-config": "2.66.0"
|
|
212
172
|
},
|
|
173
|
+
"peerDependencies": {
|
|
174
|
+
"react": "^19.2.3",
|
|
175
|
+
"react-dom": "^19.2.3"
|
|
176
|
+
},
|
|
177
|
+
"peerDependenciesMeta": {
|
|
178
|
+
"react": {
|
|
179
|
+
"optional": true
|
|
180
|
+
},
|
|
181
|
+
"react-dom": {
|
|
182
|
+
"optional": true
|
|
183
|
+
}
|
|
184
|
+
},
|
|
213
185
|
"sideEffects": false,
|
|
214
186
|
"scripts": {
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"build": "modern-lib build",
|
|
187
|
+
"dev": "rslib build --watch",
|
|
188
|
+
"build": "rslib build",
|
|
218
189
|
"test": "jest --passWithNoTests"
|
|
219
190
|
}
|
|
220
191
|
}
|
package/rslib.config.mts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { rslibConfig } from '@modern-js/rslib';
|
|
2
|
+
import { type RslibConfig, type Rspack, defineConfig } from '@rslib/core';
|
|
3
|
+
|
|
4
|
+
const dependencies = [
|
|
5
|
+
// zero dependency
|
|
6
|
+
'address',
|
|
7
|
+
'filesize',
|
|
8
|
+
'minimist',
|
|
9
|
+
'commander',
|
|
10
|
+
'import-lazy',
|
|
11
|
+
'dotenv',
|
|
12
|
+
'dotenv-expand',
|
|
13
|
+
'url-join',
|
|
14
|
+
'slash',
|
|
15
|
+
'nanoid',
|
|
16
|
+
'lodash',
|
|
17
|
+
{
|
|
18
|
+
name: 'upath',
|
|
19
|
+
},
|
|
20
|
+
// a few dependencies
|
|
21
|
+
'debug',
|
|
22
|
+
'semver',
|
|
23
|
+
'js-yaml',
|
|
24
|
+
'mime-types',
|
|
25
|
+
'strip-ansi',
|
|
26
|
+
'gzip-size',
|
|
27
|
+
'pkg-up',
|
|
28
|
+
{
|
|
29
|
+
name: 'json5',
|
|
30
|
+
externals: {
|
|
31
|
+
minimist: '../minimist',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// some dependencies
|
|
35
|
+
'glob',
|
|
36
|
+
'chalk',
|
|
37
|
+
'webpack-chain',
|
|
38
|
+
{
|
|
39
|
+
name: 'signale',
|
|
40
|
+
externals: {
|
|
41
|
+
chalk: '../chalk',
|
|
42
|
+
},
|
|
43
|
+
packageJsonField: ['options'],
|
|
44
|
+
},
|
|
45
|
+
'execa',
|
|
46
|
+
'fs-extra',
|
|
47
|
+
'browserslist',
|
|
48
|
+
'chokidar',
|
|
49
|
+
'fast-glob',
|
|
50
|
+
{
|
|
51
|
+
name: 'globby',
|
|
52
|
+
externals: {
|
|
53
|
+
'fast-glob': '../fast-glob',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'ora',
|
|
58
|
+
externals: {
|
|
59
|
+
chalk: '../chalk',
|
|
60
|
+
'strip-ansi': '../strip-ansi',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'inquirer',
|
|
65
|
+
externals: {
|
|
66
|
+
ora: '../ora',
|
|
67
|
+
chalk: '../chalk',
|
|
68
|
+
'strip-ansi': '../strip-ansi',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'tsconfig-paths',
|
|
73
|
+
externals: {
|
|
74
|
+
json5: '../json5',
|
|
75
|
+
minimist: '../minimist',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const regexpMap: Record<string, RegExp> = {};
|
|
81
|
+
|
|
82
|
+
for (const item of dependencies) {
|
|
83
|
+
const depName = typeof item === 'string' ? item : item.name;
|
|
84
|
+
|
|
85
|
+
// Skip dtsOnly dependencies
|
|
86
|
+
if (typeof item !== 'string' && 'dtsOnly' in item) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
regexpMap[depName] = new RegExp(`compiled[\\/]${depName}(?:[\\/]|$)`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const externals: Rspack.Configuration['externals'] = [
|
|
94
|
+
// externalize pre-bundled dependencies
|
|
95
|
+
({ request }, callback) => {
|
|
96
|
+
const entries = Object.entries(regexpMap);
|
|
97
|
+
if (request) {
|
|
98
|
+
for (const [name, test] of entries) {
|
|
99
|
+
if (request === name) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
`"${name}" is not allowed to be imported, use "../compiled/${name}/index.js" instead.`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
if (test.test(request)) {
|
|
105
|
+
return callback(undefined, `node-commonjs ${request}/index.js`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
callback();
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
const lib: RslibConfig['lib'] = rslibConfig.lib.map((config, index) => {
|
|
114
|
+
if (config.format === 'esm') {
|
|
115
|
+
return {
|
|
116
|
+
...config,
|
|
117
|
+
output: {
|
|
118
|
+
...config.output,
|
|
119
|
+
externals,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
...config,
|
|
125
|
+
output: {
|
|
126
|
+
...config.output,
|
|
127
|
+
copy: [
|
|
128
|
+
{
|
|
129
|
+
from: './compiled',
|
|
130
|
+
to: '../compiled',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
export default defineConfig({
|
|
138
|
+
...rslibConfig,
|
|
139
|
+
lib,
|
|
140
|
+
});
|
package/dist/cjs/cli/action.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var action_exports = {};
|
|
20
|
-
__export(action_exports, {
|
|
21
|
-
newAction: () => newAction,
|
|
22
|
-
upgradeAction: () => upgradeAction
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(action_exports);
|
|
25
|
-
var import_compiled = require("../compiled");
|
|
26
|
-
const newAction = async (config, solution) => {
|
|
27
|
-
var _process_env_MODERN_JS_VERSION;
|
|
28
|
-
await (0, import_compiled.execa)("npx", [
|
|
29
|
-
"--yes",
|
|
30
|
-
`@modern-js/new-action@${(_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest"}`,
|
|
31
|
-
`--config=${JSON.stringify(config)}`,
|
|
32
|
-
`--solution=${solution}`
|
|
33
|
-
], {
|
|
34
|
-
stderr: "inherit",
|
|
35
|
-
stdout: "inherit",
|
|
36
|
-
stdin: "inherit"
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
const upgradeAction = async () => {
|
|
40
|
-
var _process_env_MODERN_JS_VERSION;
|
|
41
|
-
await (0, import_compiled.execa)("npx", [
|
|
42
|
-
"--yes",
|
|
43
|
-
`@modern-js/upgrade@${(_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest"}`,
|
|
44
|
-
...process.argv.slice(2)
|
|
45
|
-
], {
|
|
46
|
-
stdin: "inherit",
|
|
47
|
-
stdout: "inherit",
|
|
48
|
-
stderr: "inherit"
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 && (module.exports = {
|
|
53
|
-
newAction,
|
|
54
|
-
upgradeAction
|
|
55
|
-
});
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var formatWebpack_exports = {};
|
|
20
|
-
__export(formatWebpack_exports, {
|
|
21
|
-
addErrorTips: () => addErrorTips,
|
|
22
|
-
formatWebpackMessages: () => formatWebpackMessages
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(formatWebpack_exports);
|
|
25
|
-
const friendlySyntaxErrorLabel = "SyntaxError:";
|
|
26
|
-
function isLikelyASyntaxError(message) {
|
|
27
|
-
return message.includes(friendlySyntaxErrorLabel);
|
|
28
|
-
}
|
|
29
|
-
function formatMessage(stats) {
|
|
30
|
-
let lines = [];
|
|
31
|
-
let message;
|
|
32
|
-
if (typeof stats === "object") {
|
|
33
|
-
const fileName = stats.moduleName ? `File: ${stats.moduleName}
|
|
34
|
-
` : "";
|
|
35
|
-
const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
|
|
36
|
-
const details = stats.details ? `
|
|
37
|
-
Details: ${stats.details}
|
|
38
|
-
` : "";
|
|
39
|
-
const stack = stats.stack ? `
|
|
40
|
-
${stats.stack}` : "";
|
|
41
|
-
message = `${fileName}${mainMessage}${details}${stack}`;
|
|
42
|
-
} else {
|
|
43
|
-
message = stats;
|
|
44
|
-
}
|
|
45
|
-
lines = message.split("\n");
|
|
46
|
-
lines = lines.map((line) => {
|
|
47
|
-
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
|
|
48
|
-
if (!parsingError) {
|
|
49
|
-
return line;
|
|
50
|
-
}
|
|
51
|
-
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
52
|
-
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
53
|
-
});
|
|
54
|
-
message = lines.join("\n");
|
|
55
|
-
message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)
|
|
56
|
-
`);
|
|
57
|
-
lines = message.split("\n");
|
|
58
|
-
if (lines.length > 2 && lines[1].trim() === "") {
|
|
59
|
-
lines.splice(1, 1);
|
|
60
|
-
}
|
|
61
|
-
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
|
|
62
|
-
if (lines[1] && lines[1].indexOf("Module not found:") !== -1) {
|
|
63
|
-
lines[1] = lines[1].replace("Error: ", "");
|
|
64
|
-
}
|
|
65
|
-
lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim());
|
|
66
|
-
message = lines.join("\n");
|
|
67
|
-
return message.trim();
|
|
68
|
-
}
|
|
69
|
-
const noop = (message) => message;
|
|
70
|
-
const defaultColor = {
|
|
71
|
-
gray: noop,
|
|
72
|
-
cyan: noop,
|
|
73
|
-
green: noop,
|
|
74
|
-
yellow: noop,
|
|
75
|
-
underline: noop
|
|
76
|
-
};
|
|
77
|
-
function addErrorTips(errors, color = defaultColor) {
|
|
78
|
-
const errorHelpers = [
|
|
79
|
-
{
|
|
80
|
-
validator(message) {
|
|
81
|
-
return (message.includes("You may need an appropriate loader") || message.includes("You may need an additional loader")) && message.includes(".ts");
|
|
82
|
-
},
|
|
83
|
-
formatter(message) {
|
|
84
|
-
return `${message}
|
|
85
|
-
|
|
86
|
-
${color.yellow(`If it is a TypeScript file, you can use "source.include" config to compile it. see ${color.underline("https://modernjs.dev/en/configure/app/source/include.html")}`)}
|
|
87
|
-
|
|
88
|
-
${color.green(`${color.gray("// config file")}
|
|
89
|
-
export default {
|
|
90
|
-
source: {
|
|
91
|
-
include: [
|
|
92
|
-
${color.gray("// add some include rules")}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
}`)}
|
|
96
|
-
`;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
];
|
|
100
|
-
return errors.map((error) => {
|
|
101
|
-
const helper = errorHelpers.find((item) => item.validator(error));
|
|
102
|
-
return helper ? helper.formatter(error) : error;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function formatWebpackMessages(json, color = defaultColor) {
|
|
106
|
-
var _json_errors, _json_warnings, _result_errors;
|
|
107
|
-
const formattedErrors = json === null || json === void 0 ? void 0 : (_json_errors = json.errors) === null || _json_errors === void 0 ? void 0 : _json_errors.map(formatMessage);
|
|
108
|
-
const formattedWarnings = json === null || json === void 0 ? void 0 : (_json_warnings = json.warnings) === null || _json_warnings === void 0 ? void 0 : _json_warnings.map(formatMessage);
|
|
109
|
-
const result = {
|
|
110
|
-
errors: formattedErrors || [],
|
|
111
|
-
warnings: formattedWarnings || [],
|
|
112
|
-
errorTips: []
|
|
113
|
-
};
|
|
114
|
-
if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.some(isLikelyASyntaxError)) {
|
|
115
|
-
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
116
|
-
}
|
|
117
|
-
if (result.errors.length > 1) {
|
|
118
|
-
result.errors.length = 1;
|
|
119
|
-
}
|
|
120
|
-
result.errors = addErrorTips(result.errors, color);
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
-
0 && (module.exports = {
|
|
125
|
-
addErrorTips,
|
|
126
|
-
formatWebpackMessages
|
|
127
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|