@modern-js/utils 1.17.0 → 1.18.1-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/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @modern-js/utils
2
2
 
3
+ ## 1.18.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 9fcfbd4: chore: add assets retry plugin
8
+
9
+ chore: 增加资源重试插件
10
+
11
+ - 6c2c745: chore(utils): add RULE.JS_DATA_URI to CHAIN_ID
12
+
13
+ chore(utils): CHAIN_ID 增加 RULE.JS_DATA_URI 值
14
+
15
+ ## 1.18.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 5227370: feat: add webpack-builder plugin subresource-integrity
20
+ feat: 新增 webpack-builder 插件 subresource-integrity
21
+
22
+ ### Patch Changes
23
+
24
+ - 8280920: feat: change hmr sock path to /webpack-hmr
25
+
26
+ feat: 热更新 socket 请求的 path 修改为 /webpack-hmr
27
+
28
+ - 7928bae: chore: add inspector plugin
29
+
30
+ chore: 增加 Inspector 插件
31
+
3
32
  ## 1.17.0
4
33
 
5
34
  ### Minor Changes
package/dist/chainId.d.ts CHANGED
@@ -13,6 +13,8 @@ export declare const CHAIN_ID: {
13
13
  readonly MEDIA: "media";
14
14
  /** Rule for js */
15
15
  readonly JS: "js";
16
+ /** Rule for data uri encoded javascript */
17
+ readonly JS_DATA_URI: "js-data-uri";
16
18
  /** Rule for ts */
17
19
  readonly TS: "ts";
18
20
  /** Rule for css */
@@ -108,6 +110,8 @@ export declare const CHAIN_ID: {
108
110
  readonly BANNER: "banner";
109
111
  /** Webpackbar */
110
112
  readonly PROGRESS: "progress";
113
+ /** Inspector */
114
+ readonly INSPECTOR: "inspector";
111
115
  /** AppIconPlugin */
112
116
  readonly APP_ICON: "app-icon";
113
117
  /** LoadableWebpackPlugin */
@@ -130,8 +134,10 @@ export declare const CHAIN_ID: {
130
134
  readonly REACT_FAST_REFRESH: "react-fast-refresh";
131
135
  /** ProvidePlugin for node polyfill */
132
136
  readonly NODE_POLYFILL_PROVIDE: "node-polyfill-provide";
133
- /** ModuleDependencyErrorPlugin */
134
- readonly MODULE_DEPENDENCY_ERROR: "module-dependency-error";
137
+ /** WebpackSRIPlugin */
138
+ readonly SUBRESOURCE_INTEGRITY: "subresource-integrity";
139
+ /** WebpackAssetsRetryPlugin */
140
+ readonly ASSETS_RETRY: "ASSETS_RETRY";
135
141
  };
136
142
  /** Predefined minimizers */
137
143
  readonly MINIMIZER: {
package/dist/chainId.js CHANGED
@@ -16,6 +16,8 @@ exports.CHAIN_ID = {
16
16
  MEDIA: 'media',
17
17
  /** Rule for js */
18
18
  JS: 'js',
19
+ /** Rule for data uri encoded javascript */
20
+ JS_DATA_URI: 'js-data-uri',
19
21
  /** Rule for ts */
20
22
  TS: 'ts',
21
23
  /** Rule for css */
@@ -111,6 +113,8 @@ exports.CHAIN_ID = {
111
113
  BANNER: 'banner',
112
114
  /** Webpackbar */
113
115
  PROGRESS: 'progress',
116
+ /** Inspector */
117
+ INSPECTOR: 'inspector',
114
118
  /** AppIconPlugin */
115
119
  APP_ICON: 'app-icon',
116
120
  /** LoadableWebpackPlugin */
@@ -133,8 +137,10 @@ exports.CHAIN_ID = {
133
137
  REACT_FAST_REFRESH: 'react-fast-refresh',
134
138
  /** ProvidePlugin for node polyfill */
135
139
  NODE_POLYFILL_PROVIDE: 'node-polyfill-provide',
136
- /** ModuleDependencyErrorPlugin */
137
- MODULE_DEPENDENCY_ERROR: 'module-dependency-error',
140
+ /** WebpackSRIPlugin */
141
+ SUBRESOURCE_INTEGRITY: 'subresource-integrity',
142
+ /** WebpackAssetsRetryPlugin */
143
+ ASSETS_RETRY: 'ASSETS_RETRY',
138
144
  },
139
145
  /** Predefined minimizers */
140
146
  MINIMIZER: {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * hmr socket connect path
3
3
  */
4
- export declare const HMR_SOCK_PATH = "/_modern_js_hmr_ws";
4
+ export declare const HMR_SOCK_PATH = "/webpack-hmr";
5
5
  /**
6
6
  * route specification file
7
7
  */
package/dist/constants.js CHANGED
@@ -4,7 +4,7 @@ exports.PLUGIN_SCHEMAS = exports.INTERNAL_PLUGINS = exports.DEFAULT_SERVER_CONFI
4
4
  /**
5
5
  * hmr socket connect path
6
6
  */
7
- exports.HMR_SOCK_PATH = '/_modern_js_hmr_ws';
7
+ exports.HMR_SOCK_PATH = '/webpack-hmr';
8
8
  /**
9
9
  * route specification file
10
10
  */
package/dist/path.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export declare const isPathString: (test: string) => boolean;
1
2
  export declare const isRelativePath: (test: string) => boolean;
2
3
  export declare const normalizeOutputPath: (s: string) => string;
3
4
  export declare const normalizeToPosixPath: (p: string | undefined) => string;
5
+ export declare const getTemplatePath: (prefix?: string) => string;
package/dist/path.js CHANGED
@@ -3,12 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.normalizeToPosixPath = exports.normalizeOutputPath = exports.isRelativePath = void 0;
6
+ exports.getTemplatePath = exports.normalizeToPosixPath = exports.normalizeOutputPath = exports.isRelativePath = exports.isPathString = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const os_1 = __importDefault(require("os"));
9
+ const fs_1 = __importDefault(require("fs"));
8
10
  const compiled_1 = require("./compiled");
11
+ const isPathString = (test) => path_1.default.posix.basename(test) !== test || path_1.default.win32.basename(test) !== test;
12
+ exports.isPathString = isPathString;
9
13
  const isRelativePath = (test) => /^\.\.?($|[\\/])/.test(test);
10
14
  exports.isRelativePath = isRelativePath;
11
15
  const normalizeOutputPath = (s) => s.replace(/\\/g, '\\\\');
12
16
  exports.normalizeOutputPath = normalizeOutputPath;
13
- const normalizeToPosixPath = (p) => compiled_1.upath.normalizeSafe(path_1.default.normalize(p || ''));
17
+ const normalizeToPosixPath = (p) => compiled_1.upath
18
+ .normalizeSafe(path_1.default.normalize(p || ''))
19
+ .replace(/^([a-zA-Z]+):/, (_, m) => `/${m.toLowerCase()}`);
14
20
  exports.normalizeToPosixPath = normalizeToPosixPath;
21
+ const getTemplatePath = (prefix) => {
22
+ const tmpRoot = fs_1.default.realpathSync(os_1.default.tmpdir());
23
+ const parts = [tmpRoot];
24
+ prefix && parts.push(prefix);
25
+ parts.push((0, compiled_1.nanoid)());
26
+ return path_1.default.resolve(...parts);
27
+ };
28
+ exports.getTemplatePath = getTemplatePath;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.17.0",
14
+ "version": "1.18.1-alpha.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/index.d.ts",
17
17
  "main": "./dist/index.js",
@@ -125,9 +125,9 @@
125
125
  "lodash": "^4.17.21"
126
126
  },
127
127
  "devDependencies": {
128
- "@modern-js/types": "1.17.0",
129
- "@scripts/build": "1.17.0",
130
- "@scripts/jest-config": "1.17.0",
128
+ "@modern-js/types": "1.18.1-alpha.0",
129
+ "@scripts/build": "1.18.1-alpha.0",
130
+ "@scripts/jest-config": "1.18.1-alpha.0",
131
131
  "@types/jest": "^27",
132
132
  "@types/node": "^14",
133
133
  "typescript": "^4",