@modern-js/app-tools 2.64.3 → 2.65.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.
@@ -53,11 +53,12 @@ async function generateBuilder(options, bundlerType) {
53
53
  return builder;
54
54
  }
55
55
  async function applyBuilderPlugins(builder, options) {
56
- const { builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR } = await import("../shared/builderPlugins/index.js");
56
+ const { builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR, builderPluginAdapterHooks } = await import("../shared/builderPlugins/index.js");
57
57
  builder.addPlugins([
58
58
  builderPluginAdapterBasic(),
59
59
  builderPluginAdapterSSR(options),
60
- builderPluginAdapterHtml(options)
60
+ builderPluginAdapterHtml(options),
61
+ builderPluginAdapterHooks(options)
61
62
  ]);
62
63
  builder.addPlugins([
63
64
  (0, import_adapterCopy.builderPluginAdapterCopy)(options)
@@ -0,0 +1,50 @@
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 builderHooks_exports = {};
20
+ __export(builderHooks_exports, {
21
+ builderPluginAdapterHooks: () => builderPluginAdapterHooks
22
+ });
23
+ module.exports = __toCommonJS(builderHooks_exports);
24
+ const builderPluginAdapterHooks = (options) => ({
25
+ name: "builder-plugin-support-modern-hooks",
26
+ setup(api) {
27
+ var _internalContext_pluginAPI;
28
+ const _internalContext = options.appContext._internalContext;
29
+ const hooks = (_internalContext_pluginAPI = _internalContext.pluginAPI) === null || _internalContext_pluginAPI === void 0 ? void 0 : _internalContext_pluginAPI.getHooks();
30
+ api.modifyBundlerChain(async (chain, utils) => {
31
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyBundlerChain.call(chain, utils));
32
+ });
33
+ api.modifyRsbuildConfig(async (config, utils) => {
34
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyRsbuildConfig.call(config, utils));
35
+ });
36
+ api.modifyRspackConfig(async (config, utils) => {
37
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyRspackConfig.call(config, utils));
38
+ });
39
+ api.modifyWebpackChain(async (chain, utils) => {
40
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyWebpackChain.call(chain, utils));
41
+ });
42
+ api.modifyWebpackConfig(async (config, utils) => {
43
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyWebpackConfig.call(config, utils));
44
+ });
45
+ }
46
+ });
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ builderPluginAdapterHooks
50
+ });
@@ -18,9 +18,11 @@ module.exports = __toCommonJS(builderPlugins_exports);
18
18
  __reExport(builderPlugins_exports, require("./adapterBasic"), module.exports);
19
19
  __reExport(builderPlugins_exports, require("./adapterHtml"), module.exports);
20
20
  __reExport(builderPlugins_exports, require("./adapterSSR"), module.exports);
21
+ __reExport(builderPlugins_exports, require("./builderHooks"), module.exports);
21
22
  // Annotate the CommonJS export names for ESM import in node:
22
23
  0 && (module.exports = {
23
24
  ...require("./adapterBasic"),
24
25
  ...require("./adapterHtml"),
25
- ...require("./adapterSSR")
26
+ ...require("./adapterSSR"),
27
+ ...require("./builderHooks")
26
28
  });
@@ -51,7 +51,7 @@ function applyBuilderPlugins(builder, options) {
51
51
  }
52
52
  function _applyBuilderPlugins() {
53
53
  _applyBuilderPlugins = _async_to_generator(function(builder, options) {
54
- var _ref, builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR, normalizedConfig, pluginNodePolyfill;
54
+ var _ref, builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR, builderPluginAdapterHooks, normalizedConfig, pluginNodePolyfill;
55
55
  return _ts_generator(this, function(_state) {
56
56
  switch (_state.label) {
57
57
  case 0:
@@ -60,11 +60,12 @@ function _applyBuilderPlugins() {
60
60
  import("../shared/builderPlugins/index.js")
61
61
  ];
62
62
  case 1:
63
- _ref = _state.sent(), builderPluginAdapterBasic = _ref.builderPluginAdapterBasic, builderPluginAdapterHtml = _ref.builderPluginAdapterHtml, builderPluginAdapterSSR = _ref.builderPluginAdapterSSR;
63
+ _ref = _state.sent(), builderPluginAdapterBasic = _ref.builderPluginAdapterBasic, builderPluginAdapterHtml = _ref.builderPluginAdapterHtml, builderPluginAdapterSSR = _ref.builderPluginAdapterSSR, builderPluginAdapterHooks = _ref.builderPluginAdapterHooks;
64
64
  builder.addPlugins([
65
65
  builderPluginAdapterBasic(),
66
66
  builderPluginAdapterSSR(options),
67
- builderPluginAdapterHtml(options)
67
+ builderPluginAdapterHtml(options),
68
+ builderPluginAdapterHooks(options)
68
69
  ]);
69
70
  builder.addPlugins([
70
71
  builderPluginAdapterCopy(options)
@@ -0,0 +1,120 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
+ var builderPluginAdapterHooks = function(options) {
4
+ return {
5
+ name: "builder-plugin-support-modern-hooks",
6
+ setup: function setup(api) {
7
+ var _internalContext_pluginAPI;
8
+ var _internalContext = options.appContext._internalContext;
9
+ var hooks = (_internalContext_pluginAPI = _internalContext.pluginAPI) === null || _internalContext_pluginAPI === void 0 ? void 0 : _internalContext_pluginAPI.getHooks();
10
+ api.modifyBundlerChain(function() {
11
+ var _ref = _async_to_generator(function(chain, utils) {
12
+ return _ts_generator(this, function(_state) {
13
+ switch (_state.label) {
14
+ case 0:
15
+ return [
16
+ 4,
17
+ hooks === null || hooks === void 0 ? void 0 : hooks.modifyBundlerChain.call(chain, utils)
18
+ ];
19
+ case 1:
20
+ _state.sent();
21
+ return [
22
+ 2
23
+ ];
24
+ }
25
+ });
26
+ });
27
+ return function(chain, utils) {
28
+ return _ref.apply(this, arguments);
29
+ };
30
+ }());
31
+ api.modifyRsbuildConfig(function() {
32
+ var _ref = _async_to_generator(function(config, utils) {
33
+ return _ts_generator(this, function(_state) {
34
+ switch (_state.label) {
35
+ case 0:
36
+ return [
37
+ 4,
38
+ hooks === null || hooks === void 0 ? void 0 : hooks.modifyRsbuildConfig.call(config, utils)
39
+ ];
40
+ case 1:
41
+ _state.sent();
42
+ return [
43
+ 2
44
+ ];
45
+ }
46
+ });
47
+ });
48
+ return function(config, utils) {
49
+ return _ref.apply(this, arguments);
50
+ };
51
+ }());
52
+ api.modifyRspackConfig(function() {
53
+ var _ref = _async_to_generator(function(config, utils) {
54
+ return _ts_generator(this, function(_state) {
55
+ switch (_state.label) {
56
+ case 0:
57
+ return [
58
+ 4,
59
+ hooks === null || hooks === void 0 ? void 0 : hooks.modifyRspackConfig.call(config, utils)
60
+ ];
61
+ case 1:
62
+ _state.sent();
63
+ return [
64
+ 2
65
+ ];
66
+ }
67
+ });
68
+ });
69
+ return function(config, utils) {
70
+ return _ref.apply(this, arguments);
71
+ };
72
+ }());
73
+ api.modifyWebpackChain(function() {
74
+ var _ref = _async_to_generator(function(chain, utils) {
75
+ return _ts_generator(this, function(_state) {
76
+ switch (_state.label) {
77
+ case 0:
78
+ return [
79
+ 4,
80
+ hooks === null || hooks === void 0 ? void 0 : hooks.modifyWebpackChain.call(chain, utils)
81
+ ];
82
+ case 1:
83
+ _state.sent();
84
+ return [
85
+ 2
86
+ ];
87
+ }
88
+ });
89
+ });
90
+ return function(chain, utils) {
91
+ return _ref.apply(this, arguments);
92
+ };
93
+ }());
94
+ api.modifyWebpackConfig(function() {
95
+ var _ref = _async_to_generator(function(config, utils) {
96
+ return _ts_generator(this, function(_state) {
97
+ switch (_state.label) {
98
+ case 0:
99
+ return [
100
+ 4,
101
+ hooks === null || hooks === void 0 ? void 0 : hooks.modifyWebpackConfig.call(config, utils)
102
+ ];
103
+ case 1:
104
+ _state.sent();
105
+ return [
106
+ 2
107
+ ];
108
+ }
109
+ });
110
+ });
111
+ return function(config, utils) {
112
+ return _ref.apply(this, arguments);
113
+ };
114
+ }());
115
+ }
116
+ };
117
+ };
118
+ export {
119
+ builderPluginAdapterHooks
120
+ };
@@ -1,3 +1,4 @@
1
1
  export * from "./adapterBasic";
2
2
  export * from "./adapterHtml";
3
3
  export * from "./adapterSSR";
4
+ export * from "./builderHooks";
@@ -20,11 +20,12 @@ async function generateBuilder(options, bundlerType) {
20
20
  return builder;
21
21
  }
22
22
  async function applyBuilderPlugins(builder, options) {
23
- const { builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR } = await import("../shared/builderPlugins/index.js");
23
+ const { builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR, builderPluginAdapterHooks } = await import("../shared/builderPlugins/index.js");
24
24
  builder.addPlugins([
25
25
  builderPluginAdapterBasic(),
26
26
  builderPluginAdapterSSR(options),
27
- builderPluginAdapterHtml(options)
27
+ builderPluginAdapterHtml(options),
28
+ builderPluginAdapterHooks(options)
28
29
  ]);
29
30
  builder.addPlugins([
30
31
  builderPluginAdapterCopy(options)
@@ -0,0 +1,26 @@
1
+ const builderPluginAdapterHooks = (options) => ({
2
+ name: "builder-plugin-support-modern-hooks",
3
+ setup(api) {
4
+ var _internalContext_pluginAPI;
5
+ const _internalContext = options.appContext._internalContext;
6
+ const hooks = (_internalContext_pluginAPI = _internalContext.pluginAPI) === null || _internalContext_pluginAPI === void 0 ? void 0 : _internalContext_pluginAPI.getHooks();
7
+ api.modifyBundlerChain(async (chain, utils) => {
8
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyBundlerChain.call(chain, utils));
9
+ });
10
+ api.modifyRsbuildConfig(async (config, utils) => {
11
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyRsbuildConfig.call(config, utils));
12
+ });
13
+ api.modifyRspackConfig(async (config, utils) => {
14
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyRspackConfig.call(config, utils));
15
+ });
16
+ api.modifyWebpackChain(async (chain, utils) => {
17
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyWebpackChain.call(chain, utils));
18
+ });
19
+ api.modifyWebpackConfig(async (config, utils) => {
20
+ await (hooks === null || hooks === void 0 ? void 0 : hooks.modifyWebpackConfig.call(config, utils));
21
+ });
22
+ }
23
+ });
24
+ export {
25
+ builderPluginAdapterHooks
26
+ };
@@ -1,3 +1,4 @@
1
1
  export * from "./adapterBasic";
2
2
  export * from "./adapterHtml";
3
3
  export * from "./adapterSSR";
4
+ export * from "./builderHooks";
@@ -0,0 +1,4 @@
1
+ import type { RsbuildPlugin } from '@rsbuild/core';
2
+ import type { Bundler } from '../../../types';
3
+ import type { BuilderOptions } from '../types';
4
+ export declare const builderPluginAdapterHooks: <B extends Bundler>(options: BuilderOptions<B>) => RsbuildPlugin;
@@ -1,3 +1,4 @@
1
1
  export * from './adapterBasic';
2
2
  export * from './adapterHtml';
3
3
  export * from './adapterSSR';
4
+ export * from './builderHooks';
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.64.3",
18
+ "version": "2.65.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -91,20 +91,20 @@
91
91
  "ndepe": "0.1.5",
92
92
  "pkg-types": "^1.1.0",
93
93
  "std-env": "^3.7.0",
94
- "@modern-js/core": "2.64.3",
95
- "@modern-js/node-bundle-require": "2.64.3",
96
- "@modern-js/plugin": "2.64.3",
97
- "@modern-js/plugin-data-loader": "2.64.3",
98
- "@modern-js/plugin-i18n": "2.64.3",
99
- "@modern-js/plugin-v2": "2.64.3",
100
- "@modern-js/prod-server": "2.64.3",
101
- "@modern-js/server": "2.64.3",
102
- "@modern-js/rsbuild-plugin-esbuild": "2.64.3",
103
- "@modern-js/server-core": "2.64.3",
104
- "@modern-js/server-utils": "2.64.3",
105
- "@modern-js/types": "2.64.3",
106
- "@modern-js/uni-builder": "2.64.3",
107
- "@modern-js/utils": "2.64.3"
94
+ "@modern-js/core": "2.65.0",
95
+ "@modern-js/node-bundle-require": "2.65.0",
96
+ "@modern-js/plugin": "2.65.0",
97
+ "@modern-js/plugin-data-loader": "2.65.0",
98
+ "@modern-js/plugin-i18n": "2.65.0",
99
+ "@modern-js/plugin-v2": "2.65.0",
100
+ "@modern-js/prod-server": "2.65.0",
101
+ "@modern-js/rsbuild-plugin-esbuild": "2.65.0",
102
+ "@modern-js/server": "2.65.0",
103
+ "@modern-js/server-core": "2.65.0",
104
+ "@modern-js/server-utils": "2.65.0",
105
+ "@modern-js/types": "2.65.0",
106
+ "@modern-js/uni-builder": "2.65.0",
107
+ "@modern-js/utils": "2.65.0"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@rsbuild/plugin-webpack-swc": "1.0.9",
@@ -116,8 +116,8 @@
116
116
  "tsconfig-paths": "^4.2.0",
117
117
  "typescript": "^5",
118
118
  "webpack": "^5.98.0",
119
- "@scripts/build": "2.64.3",
120
- "@scripts/jest-config": "2.64.3"
119
+ "@scripts/build": "2.65.0",
120
+ "@scripts/jest-config": "2.65.0"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "ts-node": "^10.7.0",