@modern-js/utils 2.23.0 → 2.23.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @modern-js/utils
2
2
 
3
+ ## 2.23.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f08bbfc: feat(builder): add basic Vue 3 plugin
8
+
9
+ feat(builder): 增加基础的 Vue 3 插件
10
+
11
+ - a6b313a: fix(builder): can't use new React JSX with parent's package.json
12
+
13
+ fix(builder): 修复 package.json 在父级目录时无法使用新版 react jsx 的问题
14
+
15
+ - 8f2cab0: feat(builder): support using new URL to handle wasm assets
16
+
17
+ feat(builder): 支持通过 new URL 来处理 wasm 资源
18
+
3
19
  ## 2.23.0
4
20
 
5
21
  ### Patch Changes
@@ -39,10 +39,14 @@ const CHAIN_ID = {
39
39
  SVG: "svg",
40
40
  /** Rule for pug */
41
41
  PUG: "pug",
42
+ /** Rule for Vue */
43
+ VUE: "vue",
42
44
  /** Rule for toml */
43
45
  TOML: "toml",
44
46
  /** Rule for yaml */
45
47
  YAML: "yaml",
48
+ /** Rule for wasm */
49
+ WASM: "wasm",
46
50
  /** Rule for bff */
47
51
  JS_BFF_API: "js-bff-api"
48
52
  },
@@ -69,6 +73,8 @@ const CHAIN_ID = {
69
73
  URL: "url",
70
74
  /** pug-loader */
71
75
  PUG: "pug",
76
+ /** vue-loader */
77
+ VUE: "vue",
72
78
  /** file-loader */
73
79
  FILE: "file",
74
80
  /** @svgr/webpack */
@@ -138,12 +144,16 @@ const CHAIN_ID = {
138
144
  BUNDLE_ANALYZER: "bundle-analyze",
139
145
  /** BottomTemplatePlugin */
140
146
  BOTTOM_TEMPLATE: "bottom-template",
141
- /** HtmlCrossOriginPlugin */
142
- HTML_CROSS_ORIGIN: "html-cross-origin",
147
+ /** HtmlTagsPlugin */
148
+ HTML_TAGS: "html-tags",
143
149
  /** HtmlNoncePlugin */
144
150
  HTML_NONCE: "html-nonce",
151
+ /** HtmlCrossOriginPlugin */
152
+ HTML_CROSS_ORIGIN: "html-cross-origin",
145
153
  /** MiniCssExtractPlugin */
146
154
  MINI_CSS_EXTRACT: "mini-css-extract",
155
+ /** VueLoaderPlugin */
156
+ VUE_LOADER_PLUGIN: "vue-loader-plugin",
147
157
  /** ReactFastRefreshPlugin */
148
158
  REACT_FAST_REFRESH: "react-fast-refresh",
149
159
  /** ProvidePlugin for node polyfill */
@@ -157,9 +167,7 @@ const CHAIN_ID = {
157
167
  /** HtmlAsyncChunkPlugin */
158
168
  HTML_ASYNC_CHUNK: "html-async-chunk",
159
169
  /** SWC_POLYFILL_CHECKER */
160
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
161
- /** HtmlTagsPlugin */
162
- HTML_TAGS: "html-tags"
170
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
163
171
  },
164
172
  /** Predefined minimizers */
165
173
  MINIMIZER: {
@@ -34,6 +34,7 @@ _export(exports, {
34
34
  });
35
35
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
36
36
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
37
+ const _pkgup = /* @__PURE__ */ _interop_require_default._(require("../../../compiled/pkg-up"));
37
38
  const _commands = require("../commands");
38
39
  const _compiled = require("../../compiled");
39
40
  const _common = require("../common");
@@ -73,8 +74,10 @@ const isWebOnly = async () => {
73
74
  return Boolean(options["web-only"]);
74
75
  };
75
76
  const isBeyondReact17 = (cwd) => {
76
- const pkgPath = _path.default.join(cwd, "package.json");
77
- if (!_compiled.fs.existsSync(pkgPath)) {
77
+ const pkgPath = _pkgup.default.sync({
78
+ cwd
79
+ });
80
+ if (!pkgPath) {
78
81
  return false;
79
82
  }
80
83
  const pkgInfo = JSON.parse(_compiled.fs.readFileSync(pkgPath, "utf8"));
@@ -29,10 +29,14 @@ export const CHAIN_ID = {
29
29
  SVG: "svg",
30
30
  /** Rule for pug */
31
31
  PUG: "pug",
32
+ /** Rule for Vue */
33
+ VUE: "vue",
32
34
  /** Rule for toml */
33
35
  TOML: "toml",
34
36
  /** Rule for yaml */
35
37
  YAML: "yaml",
38
+ /** Rule for wasm */
39
+ WASM: "wasm",
36
40
  /** Rule for bff */
37
41
  JS_BFF_API: "js-bff-api"
38
42
  },
@@ -59,6 +63,8 @@ export const CHAIN_ID = {
59
63
  URL: "url",
60
64
  /** pug-loader */
61
65
  PUG: "pug",
66
+ /** vue-loader */
67
+ VUE: "vue",
62
68
  /** file-loader */
63
69
  FILE: "file",
64
70
  /** @svgr/webpack */
@@ -128,12 +134,16 @@ export const CHAIN_ID = {
128
134
  BUNDLE_ANALYZER: "bundle-analyze",
129
135
  /** BottomTemplatePlugin */
130
136
  BOTTOM_TEMPLATE: "bottom-template",
131
- /** HtmlCrossOriginPlugin */
132
- HTML_CROSS_ORIGIN: "html-cross-origin",
137
+ /** HtmlTagsPlugin */
138
+ HTML_TAGS: "html-tags",
133
139
  /** HtmlNoncePlugin */
134
140
  HTML_NONCE: "html-nonce",
141
+ /** HtmlCrossOriginPlugin */
142
+ HTML_CROSS_ORIGIN: "html-cross-origin",
135
143
  /** MiniCssExtractPlugin */
136
144
  MINI_CSS_EXTRACT: "mini-css-extract",
145
+ /** VueLoaderPlugin */
146
+ VUE_LOADER_PLUGIN: "vue-loader-plugin",
137
147
  /** ReactFastRefreshPlugin */
138
148
  REACT_FAST_REFRESH: "react-fast-refresh",
139
149
  /** ProvidePlugin for node polyfill */
@@ -147,9 +157,7 @@ export const CHAIN_ID = {
147
157
  /** HtmlAsyncChunkPlugin */
148
158
  HTML_ASYNC_CHUNK: "html-async-chunk",
149
159
  /** SWC_POLYFILL_CHECKER */
150
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
151
- /** HtmlTagsPlugin */
152
- HTML_TAGS: "html-tags"
160
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
153
161
  },
154
162
  /** Predefined minimizers */
155
163
  MINIMIZER: {
@@ -1,4 +1,5 @@
1
1
  import path from "path";
2
+ import pkgUp from "../../../compiled/pkg-up";
2
3
  import { getArgv } from "../commands";
3
4
  import { fs, minimist, semver } from "../../compiled";
4
5
  import { createDebugger } from "../common";
@@ -38,8 +39,10 @@ export const isWebOnly = async () => {
38
39
  return Boolean(options["web-only"]);
39
40
  };
40
41
  export const isBeyondReact17 = (cwd) => {
41
- const pkgPath = path.join(cwd, "package.json");
42
- if (!fs.existsSync(pkgPath)) {
42
+ const pkgPath = pkgUp.sync({
43
+ cwd
44
+ });
45
+ if (!pkgPath) {
43
46
  return false;
44
47
  }
45
48
  const pkgInfo = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
@@ -29,10 +29,14 @@ export declare const CHAIN_ID: {
29
29
  readonly SVG: "svg";
30
30
  /** Rule for pug */
31
31
  readonly PUG: "pug";
32
+ /** Rule for Vue */
33
+ readonly VUE: "vue";
32
34
  /** Rule for toml */
33
35
  readonly TOML: "toml";
34
36
  /** Rule for yaml */
35
37
  readonly YAML: "yaml";
38
+ /** Rule for wasm */
39
+ readonly WASM: "wasm";
36
40
  /** Rule for bff */
37
41
  readonly JS_BFF_API: "js-bff-api";
38
42
  };
@@ -59,6 +63,8 @@ export declare const CHAIN_ID: {
59
63
  readonly URL: "url";
60
64
  /** pug-loader */
61
65
  readonly PUG: "pug";
66
+ /** vue-loader */
67
+ readonly VUE: "vue";
62
68
  /** file-loader */
63
69
  readonly FILE: "file";
64
70
  /** @svgr/webpack */
@@ -128,12 +134,16 @@ export declare const CHAIN_ID: {
128
134
  readonly BUNDLE_ANALYZER: "bundle-analyze";
129
135
  /** BottomTemplatePlugin */
130
136
  readonly BOTTOM_TEMPLATE: "bottom-template";
131
- /** HtmlCrossOriginPlugin */
132
- readonly HTML_CROSS_ORIGIN: "html-cross-origin";
137
+ /** HtmlTagsPlugin */
138
+ readonly HTML_TAGS: "html-tags";
133
139
  /** HtmlNoncePlugin */
134
140
  readonly HTML_NONCE: "html-nonce";
141
+ /** HtmlCrossOriginPlugin */
142
+ readonly HTML_CROSS_ORIGIN: "html-cross-origin";
135
143
  /** MiniCssExtractPlugin */
136
144
  readonly MINI_CSS_EXTRACT: "mini-css-extract";
145
+ /** VueLoaderPlugin */
146
+ readonly VUE_LOADER_PLUGIN: "vue-loader-plugin";
137
147
  /** ReactFastRefreshPlugin */
138
148
  readonly REACT_FAST_REFRESH: "react-fast-refresh";
139
149
  /** ProvidePlugin for node polyfill */
@@ -148,8 +158,6 @@ export declare const CHAIN_ID: {
148
158
  readonly HTML_ASYNC_CHUNK: "html-async-chunk";
149
159
  /** SWC_POLYFILL_CHECKER */
150
160
  readonly SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin";
151
- /** HtmlTagsPlugin */
152
- readonly HTML_TAGS: "html-tags";
153
161
  };
154
162
  /** Predefined minimizers */
155
163
  readonly MINIMIZER: {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.23.0",
18
+ "version": "2.23.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -235,9 +235,9 @@
235
235
  "typescript": "^5",
236
236
  "webpack": "^5.82.1",
237
237
  "@types/serialize-javascript": "^5.0.1",
238
- "@modern-js/types": "2.23.0",
239
- "@scripts/build": "2.23.0",
240
- "@scripts/jest-config": "2.23.0"
238
+ "@modern-js/types": "2.23.1",
239
+ "@scripts/build": "2.23.1",
240
+ "@scripts/jest-config": "2.23.1"
241
241
  },
242
242
  "sideEffects": false,
243
243
  "scripts": {