@modern-js/plugin-module-import 2.35.0 → 2.36.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/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';
2
- import type { ImportItem } from '@modern-js/libuild-plugin-swc';
1
+ import type { CliPlugin, ModuleTools, BaseBuildConfig } from '@modern-js/module-tools';
2
+ /**
3
+ * use config 'transformImport' instead.
4
+ * @deprecated
5
+ */
3
6
  export declare const modulePluginImport: (options: {
4
- pluginImport?: ImportItem[];
7
+ pluginImport?: BaseBuildConfig['transformImport'];
5
8
  }) => CliPlugin<ModuleTools>;
6
9
  export default modulePluginImport;
package/dist/index.js CHANGED
@@ -1,58 +1,39 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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) => {
6
7
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- modulePluginImport: function() {
14
- return modulePluginImport;
15
- },
16
- // deprecated default export
17
- default: function() {
18
- return _default;
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 });
19
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var src_exports = {};
20
+ __export(src_exports, {
21
+ default: () => src_default,
22
+ modulePluginImport: () => modulePluginImport
20
23
  });
21
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
22
- const _libuildpluginswc = require("@modern-js/libuild-plugin-swc");
24
+ module.exports = __toCommonJS(src_exports);
23
25
  const modulePluginImport = (options) => ({
24
26
  name: "@modern-js/plugin-module-import",
25
27
  setup: () => ({
26
28
  beforeBuildTask(config) {
27
29
  var _options_pluginImport;
28
- config.transformImport = (_options_pluginImport = options.pluginImport) !== null && _options_pluginImport !== void 0 ? _options_pluginImport : [];
30
+ config.transformImport = (_options_pluginImport = options.pluginImport) !== null && _options_pluginImport !== void 0 ? _options_pluginImport : config.transformImport;
29
31
  return config;
30
- },
31
- async modifyLibuild(config, next) {
32
- var _config_plugins, _config_plugins1;
33
- if ((_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.find((p) => p.name === _libuildpluginswc.swcTransformPluginName)) {
34
- return next(config);
35
- }
36
- if (!options.pluginImport || options.pluginImport.length === 0) {
37
- return next(config);
38
- }
39
- const { transformPlugin } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/libuild-plugin-swc")));
40
- var _options_pluginImport;
41
- (_config_plugins1 = config.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(transformPlugin({
42
- jsc: {
43
- // swc transform jsx to `React.createElement` in default mode.
44
- transform: {
45
- react: {
46
- runtime: config.jsx === "transform" ? "classic" : "automatic"
47
- }
48
- }
49
- },
50
- extensions: {
51
- pluginImport: (_options_pluginImport = options.pluginImport) !== null && _options_pluginImport !== void 0 ? _options_pluginImport : []
52
- }
53
- }));
54
- return next(config);
55
32
  }
56
33
  })
57
34
  });
58
- const _default = modulePluginImport;
35
+ var src_default = modulePluginImport;
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ modulePluginImport
39
+ });
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "@modern-js/plugin-module-import",
3
+ "version": "2.36.0",
3
4
  "description": "The import plugin of Modern.js Module.",
5
+ "keywords": [
6
+ "react",
7
+ "framework",
8
+ "modern",
9
+ "modern.js"
10
+ ],
4
11
  "homepage": "https://modernjs.dev/module-tools",
5
12
  "bugs": "https://github.com/modern-js-dev/modern.js/issues",
6
13
  "repository": {
@@ -9,15 +16,6 @@
9
16
  "directory": "packages/module/plugin-module-import"
10
17
  },
11
18
  "license": "MIT",
12
- "keywords": [
13
- "react",
14
- "framework",
15
- "modern",
16
- "modern.js"
17
- ],
18
- "version": "2.35.0",
19
- "types": "./dist/index.d.ts",
20
- "main": "./dist/index.js",
21
19
  "exports": {
22
20
  ".": {
23
21
  "node": {
@@ -26,23 +24,24 @@
26
24
  }
27
25
  }
28
26
  },
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
29
  "dependencies": {
30
- "@swc/helpers": "0.5.1",
31
- "@modern-js/libuild-plugin-swc": "2.35.0"
30
+ "@modern-js/swc-plugins": "0.6.4",
31
+ "@swc/helpers": "0.5.1"
32
32
  },
33
33
  "devDependencies": {
34
+ "@swc/helpers": "0.5.1",
34
35
  "@types/jest": "^29",
35
36
  "@types/node": "^14",
36
- "typescript": "^5",
37
37
  "jest": "^29",
38
- "@swc/helpers": "0.5.1",
39
- "@modern-js/module-tools": "2.35.0",
40
- "@modern-js/libuild": "2.35.0",
41
- "@scripts/jest-config": "2.35.0",
42
- "@scripts/build": "2.35.0"
38
+ "typescript": "^5",
39
+ "@scripts/build": "2.36.0",
40
+ "@modern-js/module-tools": "2.36.0",
41
+ "@scripts/jest-config": "2.36.0"
43
42
  },
44
43
  "peerDependencies": {
45
- "@modern-js/module-tools": "^2.35.0"
44
+ "@modern-js/module-tools": "^2.36.0"
46
45
  },
47
46
  "peerDependenciesMeta": {
48
47
  "@modern-js/module-tools": {
@@ -50,13 +49,13 @@
50
49
  }
51
50
  },
52
51
  "publishConfig": {
53
- "registry": "https://registry.npmjs.org/",
54
52
  "access": "public",
55
- "provenance": true
53
+ "provenance": true,
54
+ "registry": "https://registry.npmjs.org/"
56
55
  },
57
56
  "scripts": {
58
- "dev": "mdn build --watch",
59
57
  "build": "mdn build",
58
+ "dev": "mdn build --watch",
60
59
  "test": "jest --passWithNoTests"
61
60
  }
62
61
  }