@modern-js/plugin-module-polyfill 2.27.0 → 2.28.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.js +57 -52
- package/dist/log/en.d.ts +3 -0
- package/dist/log/en.js +13 -0
- package/dist/log/index.d.ts +5 -0
- package/dist/log/index.js +27 -0
- package/dist/log/zh.d.ts +3 -0
- package/dist/log/zh.js +13 -0
- package/package.json +9 -6
- package/dist/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# @modern-js/plugin-module-polyfill
|
2
2
|
|
3
|
+
## 2.28.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- d3e52e4: chore(CI): update build config to improve vitest CI perf
|
8
|
+
|
9
|
+
chore(CI): 更新构建配置来提升 vitest CI 性能
|
10
|
+
|
11
|
+
- Updated dependencies [3092f1f]
|
12
|
+
- Updated dependencies [118c1c0]
|
13
|
+
- Updated dependencies [b7a8c43]
|
14
|
+
- Updated dependencies [d3e52e4]
|
15
|
+
- @modern-js/module-tools@2.28.0
|
16
|
+
|
3
17
|
## 2.27.0
|
4
18
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
import { CliPlugin, ModuleTools } from '@modern-js/module-tools';
|
2
|
-
|
3
|
-
|
4
|
-
targets?: Record<string, string> | string;
|
1
|
+
import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';
|
2
|
+
export declare const ModulePolyfillPlugin: (options?: {
|
3
|
+
targets?: Record<string, string> | string;
|
5
4
|
}) => CliPlugin<ModuleTools>;
|
6
|
-
|
7
|
-
export { ModulePolyfillPlugin, ModulePolyfillPlugin as modulePluginPolyfill };
|
5
|
+
export { ModulePolyfillPlugin as modulePluginPolyfill };
|
package/dist/index.js
CHANGED
@@ -1,58 +1,63 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
6
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
10
|
+
});
|
11
|
+
}
|
12
|
+
_export(exports, {
|
13
|
+
ModulePolyfillPlugin: function() {
|
14
|
+
return ModulePolyfillPlugin;
|
15
|
+
},
|
16
|
+
modulePluginPolyfill: function() {
|
17
|
+
return ModulePolyfillPlugin;
|
14
18
|
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
|
19
|
-
// src/index.ts
|
20
|
-
var src_exports = {};
|
21
|
-
__export(src_exports, {
|
22
|
-
ModulePolyfillPlugin: () => ModulePolyfillPlugin,
|
23
|
-
modulePluginPolyfill: () => ModulePolyfillPlugin
|
24
19
|
});
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
const _libuildpluginbabel = require("@modern-js/libuild-plugin-babel");
|
21
|
+
const _utils = require("@modern-js/utils");
|
22
|
+
const _log = require("./log");
|
23
|
+
const ModulePolyfillPlugin = (options) => ({
|
28
24
|
name: "@modern-js/plugin-module-polyfill",
|
29
|
-
setup: () =>
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
require("
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
25
|
+
setup: async () => {
|
26
|
+
const logs = await (0, _log.getLogs)();
|
27
|
+
return {
|
28
|
+
modifyLibuild(config) {
|
29
|
+
var _options, _config_plugins;
|
30
|
+
let version;
|
31
|
+
try {
|
32
|
+
({ version } = require("core-js-pure/package.json"));
|
33
|
+
} catch (e) {
|
34
|
+
_utils.logger.error(logs.errorWhenFindCorePureJs);
|
35
|
+
throw e;
|
36
|
+
}
|
37
|
+
const plugins = [
|
38
|
+
[
|
39
|
+
require("@babel/plugin-syntax-typescript"),
|
40
|
+
{
|
41
|
+
isTSX: true
|
42
|
+
}
|
43
|
+
],
|
44
|
+
[
|
45
|
+
require("@babel/plugin-syntax-jsx")
|
46
|
+
],
|
47
|
+
[
|
48
|
+
require("babel-plugin-polyfill-corejs3"),
|
49
|
+
{
|
50
|
+
method: "usage-pure",
|
51
|
+
targets: (_options = options) === null || _options === void 0 ? void 0 : _options.targets,
|
52
|
+
version
|
53
|
+
}
|
54
|
+
]
|
55
|
+
];
|
56
|
+
(_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push((0, _libuildpluginbabel.babelPlugin)({
|
45
57
|
plugins
|
46
|
-
})
|
47
|
-
|
48
|
-
|
49
|
-
}
|
50
|
-
}
|
51
|
-
});
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
53
|
-
0 && (module.exports = {
|
54
|
-
ModulePolyfillPlugin,
|
55
|
-
modulePluginPolyfill
|
58
|
+
}));
|
59
|
+
return config;
|
60
|
+
}
|
61
|
+
};
|
62
|
+
}
|
56
63
|
});
|
57
|
-
|
58
|
-
//# sourceMappingURL=index.js.map
|
package/dist/log/en.d.ts
ADDED
package/dist/log/en.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "EN_LOG", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return EN_LOG;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const EN_LOG = {
|
12
|
+
errorWhenFindCorePureJs: "Happen error when getting core-js-pure version!"
|
13
|
+
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getLogs", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return getLogs;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _plugini18n = require("@modern-js/plugin-i18n");
|
13
|
+
const _zh = require("./zh");
|
14
|
+
const _en = require("./en");
|
15
|
+
const getLogs = async () => {
|
16
|
+
const i18n = new _plugini18n.I18n();
|
17
|
+
const localeKeys = i18n.init("en", {
|
18
|
+
zh: _zh.ZH_LOG,
|
19
|
+
en: _en.EN_LOG
|
20
|
+
});
|
21
|
+
const { getLocaleLanguage } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/plugin-i18n/language-detector")));
|
22
|
+
const locale = getLocaleLanguage();
|
23
|
+
i18n.changeLanguage({
|
24
|
+
locale
|
25
|
+
});
|
26
|
+
return localeKeys;
|
27
|
+
};
|
package/dist/log/zh.d.ts
ADDED
package/dist/log/zh.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "ZH_LOG", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return ZH_LOG;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const ZH_LOG = {
|
12
|
+
errorWhenFindCorePureJs: "在获取 core-js-pure 版本的时候发生错误!"
|
13
|
+
};
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.28.0-beta.0",
|
19
19
|
"types": "./dist/index.d.ts",
|
20
20
|
"main": "./dist/index.js",
|
21
21
|
"devDependencies": {
|
@@ -23,12 +23,13 @@
|
|
23
23
|
"@types/node": "^14",
|
24
24
|
"typescript": "^5",
|
25
25
|
"jest": "^29",
|
26
|
-
"@
|
27
|
-
"@
|
28
|
-
"@
|
26
|
+
"@swc/helpers": "0.5.1",
|
27
|
+
"@modern-js/module-tools": "2.28.0",
|
28
|
+
"@scripts/build": "2.28.0",
|
29
|
+
"@scripts/jest-config": "2.28.0"
|
29
30
|
},
|
30
31
|
"peerDependencies": {
|
31
|
-
"@modern-js/module-tools": "^2.
|
32
|
+
"@modern-js/module-tools": "^2.28.0",
|
32
33
|
"core-js-pure": "^3.25.0"
|
33
34
|
},
|
34
35
|
"dependencies": {
|
@@ -36,7 +37,9 @@
|
|
36
37
|
"@babel/plugin-syntax-typescript": "7.21.4",
|
37
38
|
"@babel/plugin-syntax-jsx": "7.21.4",
|
38
39
|
"@modern-js/libuild-plugin-babel": "0.7.1",
|
39
|
-
"babel-plugin-polyfill-corejs3": "0.5.2"
|
40
|
+
"babel-plugin-polyfill-corejs3": "0.5.2",
|
41
|
+
"@modern-js/utils": "2.28.0",
|
42
|
+
"@modern-js/plugin-i18n": "2.28.0"
|
40
43
|
},
|
41
44
|
"sideEffects": false,
|
42
45
|
"publishConfig": {
|
package/dist/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAA4B;AAGrB,IAAM,uBAAuB,CAAC,aAEN;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO,OAAO;AAAA,IACZ,cAAc,QAAQ;AAT1B;AAUM,YAAM,UAAU;AAAA,QACd,CAAC,QAAQ,iCAAiC,GAAG,EAAE,OAAO,KAAK,CAAC;AAAA,QAC5D,CAAC,QAAQ,0BAA0B,CAAC;AAAA,QACpC;AAAA,UACE,QAAQ,+BAA+B;AAAA,UACvC;AAAA,YACE,QAAQ;AAAA,YACR,SAAS,mCAAS;AAAA,UACpB;AAAA,QACF;AAAA,MACF;AACA,mBAAO,YAAP,mBAAgB;AAAA,YACd,yCAAY;AAAA,UACV;AAAA,QACF,CAAC;AAAA;AAEH,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\nimport { babelPlugin } from '@modern-js/libuild-plugin-babel';\n\n// deprecated named export\nexport const ModulePolyfillPlugin = (options?: {\n targets?: Record<string, string> | string;\n}): CliPlugin<ModuleTools> => ({\n name: '@modern-js/plugin-module-polyfill',\n setup: () => ({\n modifyLibuild(config) {\n const plugins = [\n [require('@babel/plugin-syntax-typescript'), { isTSX: true }],\n [require('@babel/plugin-syntax-jsx')],\n [\n require('babel-plugin-polyfill-corejs3'),\n {\n method: 'usage-pure',\n targets: options?.targets,\n },\n ],\n ];\n config.plugins?.push(\n babelPlugin({\n plugins,\n }),\n );\n return config;\n },\n }),\n});\n\n// right named export\nexport { ModulePolyfillPlugin as modulePluginPolyfill };\n"]}
|