@unpackjs/plugin-react 2.0.0 → 2.1.1

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/mpa.cjs DELETED
@@ -1,152 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- applyMpaConfig: ()=>applyMpaConfig
37
- });
38
- const external_node_fs_namespaceObject = require("node:fs");
39
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
40
- const external_node_path_namespaceObject = require("node:path");
41
- var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
42
- const core_namespaceObject = require("@unpackjs/core");
43
- const applyMpaConfig = ({ config, unpackConfig, mergeConfig, HtmlPlugin })=>{
44
- if (!unpackConfig.mpa) return config;
45
- const isRspack = 'rspack' === unpackConfig.bundler;
46
- const tempDirectory = external_node_path_default().join(core_namespaceObject.TEMP_DIR, 'mpa');
47
- const userOptions = (0, core_namespaceObject.isPlainObject)(unpackConfig.mpa) ? unpackConfig.mpa : {};
48
- const getPageConfig = (indexPath)=>{
49
- const filePath = external_node_path_default().join(indexPath, '../config.json');
50
- let pageConfig = {};
51
- if (external_node_fs_default().existsSync(filePath)) pageConfig = JSON.parse(external_node_fs_default().readFileSync(filePath, 'utf-8'));
52
- return pageConfig;
53
- };
54
- const createTempFile = (entry)=>{
55
- var _userOptions_globalImport, _unpackConfig_html;
56
- (0, core_namespaceObject.removeDir)(external_node_path_default().join(unpackConfig.root, tempDirectory));
57
- const globalImport = (null == (_userOptions_globalImport = userOptions.globalImport) ? void 0 : _userOptions_globalImport.reduce((acc, curr)=>`${acc}\nimport '${(0, core_namespaceObject.getPathInJs)(external_node_path_default().resolve(unpackConfig.root, curr))}'`, '')) || '';
58
- const { layout } = userOptions;
59
- const layoutImport = layout ? `import Layout from '${(0, core_namespaceObject.getPathInJs)(external_node_path_default().resolve(unpackConfig.root, layout))}'` : '';
60
- const layoutJSX = layout ? '<Layout><App /></Layout>' : '<App />';
61
- const rootElement = `document.getElementById('${null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.mountId}')`;
62
- const reactDOMSource = 'react-dom/client';
63
- const renderer = `ReactDOM.createRoot(${rootElement}).render(${layoutJSX})`;
64
- Object.entries(entry).forEach(([entryName, entryConfig])=>{
65
- const filePath = external_node_path_default().join(unpackConfig.root, tempDirectory, `${entryName}.jsx`);
66
- const tpl = `
67
- import React from 'react'
68
- import ReactDOM from '${reactDOMSource}'
69
- import App from '${(0, core_namespaceObject.getPathInJs)(entryConfig.import[0])}'${layoutImport && `\n${layoutImport}`}
70
- ${globalImport}
71
- ${renderer}
72
- `;
73
- const dir = external_node_path_default().dirname(filePath);
74
- if (!external_node_fs_default().existsSync(dir)) external_node_fs_default().mkdirSync(dir, {
75
- recursive: true
76
- });
77
- external_node_fs_default().writeFileSync(filePath, tpl, 'utf-8');
78
- entryConfig.import[0] = filePath;
79
- });
80
- return entry;
81
- };
82
- const collectEntry = ()=>{
83
- const start = performance.now();
84
- const entry = {};
85
- const html = [];
86
- const getIndexFilePath = (dir)=>{
87
- const extensions = [
88
- '.tsx',
89
- '.jsx'
90
- ];
91
- for (const extension of extensions){
92
- const indexFilePath = external_node_path_default().join(dir, `index${extension}`);
93
- if (external_node_fs_default().existsSync(indexFilePath)) return indexFilePath;
94
- }
95
- return null;
96
- };
97
- const pagesRoot = external_node_path_default().join(unpackConfig.root, 'src', 'pages');
98
- external_node_fs_default().readdirSync(pagesRoot).forEach((filename)=>{
99
- if (filename.startsWith('.')) return;
100
- const indexFilePath = getIndexFilePath(external_node_path_default().join(pagesRoot, filename));
101
- if (indexFilePath) {
102
- var _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8;
103
- const pageConfig = getPageConfig(indexFilePath);
104
- let entryName = true === userOptions.lowerCase ? filename.toLowerCase() : filename;
105
- if (pageConfig.filename) entryName = pageConfig.filename.slice(0, -5);
106
- entry[entryName] = {
107
- import: [
108
- indexFilePath
109
- ]
110
- };
111
- if (pageConfig.template) pageConfig.template = external_node_path_default().join(indexFilePath, '../', pageConfig.template);
112
- html.push({
113
- template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || (isRspack ? void 0 : ''),
114
- templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? isRspack ? void 0 : false : core_namespaceObject.TEMPLATE_CONTENT),
115
- minify: false,
116
- filename: `${entryName}.html`,
117
- chunks: [
118
- entryName
119
- ],
120
- ...pageConfig,
121
- templateParameters: {
122
- mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
123
- title: (0, core_namespaceObject.isFunction)(null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title) ? null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title({
124
- entryName
125
- }) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
126
- headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
127
- ...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
128
- ...pageConfig.templateParameters
129
- }
130
- });
131
- }
132
- });
133
- (0, core_namespaceObject.isDevServer)() || core_namespaceObject.logger.info(`collect entries in ${(performance.now() - start).toFixed(2)}ms ${core_namespaceObject.colors.dim('[MPA]')}`);
134
- return {
135
- entry,
136
- html
137
- };
138
- };
139
- const { entry, html } = collectEntry();
140
- config = mergeConfig(config, {
141
- entry: createTempFile(entry),
142
- plugins: html.map((h)=>new HtmlPlugin(h))
143
- });
144
- return config;
145
- };
146
- exports.applyMpaConfig = __webpack_exports__.applyMpaConfig;
147
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
148
- "applyMpaConfig"
149
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
150
- Object.defineProperty(exports, '__esModule', {
151
- value: true
152
- });
package/dist/mpa.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"mpa.d.ts","sourceRoot":"","sources":["../src/mpa.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,oBAAoB,EAGzB,KAAK,YAAY,EAQlB,MAAM,gBAAgB,CAAA;AAYvB,eAAO,MAAM,cAAc,uDAKxB;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,WAAW,EAAE,CAAC,GAAG,OAAO,EAAE,oBAAoB,EAAE,KAAK,oBAAoB,CAAA;IACzE,UAAU,EAAE,GAAG,CAAA;CAChB,KAAG,oBA6GH,CAAA"}
package/dist/mpa.js DELETED
@@ -1,109 +0,0 @@
1
- import __rslib_shim_module__ from 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
4
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
5
- import * as __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__ from "@unpackjs/core";
6
- const applyMpaConfig = ({ config, unpackConfig, mergeConfig, HtmlPlugin })=>{
7
- if (!unpackConfig.mpa) return config;
8
- const isRspack = 'rspack' === unpackConfig.bundler;
9
- const tempDirectory = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(__WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.TEMP_DIR, 'mpa');
10
- const userOptions = (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.isPlainObject)(unpackConfig.mpa) ? unpackConfig.mpa : {};
11
- const getPageConfig = (indexPath)=>{
12
- const filePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(indexPath, '../config.json');
13
- let pageConfig = {};
14
- if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(filePath)) pageConfig = JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(filePath, 'utf-8'));
15
- return pageConfig;
16
- };
17
- const createTempFile = (entry)=>{
18
- var _userOptions_globalImport, _unpackConfig_html;
19
- (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.removeDir)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(unpackConfig.root, tempDirectory));
20
- const globalImport = (null == (_userOptions_globalImport = userOptions.globalImport) ? void 0 : _userOptions_globalImport.reduce((acc, curr)=>`${acc}\nimport '${(0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.getPathInJs)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(unpackConfig.root, curr))}'`, '')) || '';
21
- const { layout } = userOptions;
22
- const layoutImport = layout ? `import Layout from '${(0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.getPathInJs)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(unpackConfig.root, layout))}'` : '';
23
- const layoutJSX = layout ? '<Layout><App /></Layout>' : '<App />';
24
- const rootElement = `document.getElementById('${null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.mountId}')`;
25
- const reactDOMSource = 'react-dom/client';
26
- const renderer = `ReactDOM.createRoot(${rootElement}).render(${layoutJSX})`;
27
- Object.entries(entry).forEach(([entryName, entryConfig])=>{
28
- const filePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(unpackConfig.root, tempDirectory, `${entryName}.jsx`);
29
- const tpl = `
30
- import React from 'react'
31
- import ReactDOM from '${reactDOMSource}'
32
- import App from '${(0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.getPathInJs)(entryConfig.import[0])}'${layoutImport && `\n${layoutImport}`}
33
- ${globalImport}
34
- ${renderer}
35
- `;
36
- const dir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(filePath);
37
- if (!__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(dir)) __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].mkdirSync(dir, {
38
- recursive: true
39
- });
40
- __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].writeFileSync(filePath, tpl, 'utf-8');
41
- entryConfig.import[0] = filePath;
42
- });
43
- return entry;
44
- };
45
- const collectEntry = ()=>{
46
- const start = performance.now();
47
- const entry = {};
48
- const html = [];
49
- const getIndexFilePath = (dir)=>{
50
- const extensions = [
51
- '.tsx',
52
- '.jsx'
53
- ];
54
- for (const extension of extensions){
55
- const indexFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, `index${extension}`);
56
- if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(indexFilePath)) return indexFilePath;
57
- }
58
- return null;
59
- };
60
- const pagesRoot = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(unpackConfig.root, 'src', 'pages');
61
- __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readdirSync(pagesRoot).forEach((filename)=>{
62
- if (filename.startsWith('.')) return;
63
- const indexFilePath = getIndexFilePath(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(pagesRoot, filename));
64
- if (indexFilePath) {
65
- var _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8;
66
- const pageConfig = getPageConfig(indexFilePath);
67
- let entryName = true === userOptions.lowerCase ? filename.toLowerCase() : filename;
68
- if (pageConfig.filename) entryName = pageConfig.filename.slice(0, -5);
69
- entry[entryName] = {
70
- import: [
71
- indexFilePath
72
- ]
73
- };
74
- if (pageConfig.template) pageConfig.template = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(indexFilePath, '../', pageConfig.template);
75
- html.push({
76
- template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || (isRspack ? void 0 : ''),
77
- templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? isRspack ? void 0 : false : __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.TEMPLATE_CONTENT),
78
- minify: false,
79
- filename: `${entryName}.html`,
80
- chunks: [
81
- entryName
82
- ],
83
- ...pageConfig,
84
- templateParameters: {
85
- mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
86
- title: (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.isFunction)(null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title) ? null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title({
87
- entryName
88
- }) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
89
- headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
90
- ...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
91
- ...pageConfig.templateParameters
92
- }
93
- });
94
- }
95
- });
96
- (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.isDevServer)() || __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.logger.info(`collect entries in ${(performance.now() - start).toFixed(2)}ms ${__WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.colors.dim('[MPA]')}`);
97
- return {
98
- entry,
99
- html
100
- };
101
- };
102
- const { entry, html } = collectEntry();
103
- config = mergeConfig(config, {
104
- entry: createTempFile(entry),
105
- plugins: html.map((h)=>new HtmlPlugin(h))
106
- });
107
- return config;
108
- };
109
- export { applyMpaConfig };
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- default: ()=>reactCompilerLoader
37
- });
38
- const core_namespaceObject = require("@babel/core");
39
- const plugin_proposal_decorators_namespaceObject = require("@babel/plugin-proposal-decorators");
40
- var plugin_proposal_decorators_default = /*#__PURE__*/ __webpack_require__.n(plugin_proposal_decorators_namespaceObject);
41
- const plugin_transform_class_properties_namespaceObject = require("@babel/plugin-transform-class-properties");
42
- var plugin_transform_class_properties_default = /*#__PURE__*/ __webpack_require__.n(plugin_transform_class_properties_namespaceObject);
43
- const external_babel_plugin_react_compiler_namespaceObject = require("babel-plugin-react-compiler");
44
- var external_babel_plugin_react_compiler_default = /*#__PURE__*/ __webpack_require__.n(external_babel_plugin_react_compiler_namespaceObject);
45
- const defaultBabelParsePlugins = [
46
- 'jsx',
47
- "typescript"
48
- ];
49
- async function reactCompilerLoader(input, _inputSourceMap) {
50
- const callback = this.async();
51
- try {
52
- const options = this.getOptions();
53
- const result = await core_namespaceObject.transformAsync(input, {
54
- sourceFileName: this.resourcePath,
55
- filename: this.resourcePath,
56
- cloneInputAst: false,
57
- plugins: [
58
- [
59
- external_babel_plugin_react_compiler_default(),
60
- options
61
- ],
62
- [
63
- plugin_proposal_decorators_default(),
64
- {
65
- legacy: true
66
- }
67
- ],
68
- [
69
- plugin_transform_class_properties_default()
70
- ]
71
- ],
72
- parserOpts: {
73
- plugins: [
74
- ...defaultBabelParsePlugins
75
- ]
76
- },
77
- ast: false,
78
- sourceMaps: true,
79
- configFile: false,
80
- babelrc: false
81
- });
82
- if (!result) throw new TypeError('babel.transformAsync with react compiler plugin returns null');
83
- const { code, map } = result;
84
- callback(null, code ?? void 0, map ?? void 0);
85
- } catch (e) {
86
- callback(e);
87
- }
88
- }
89
- exports["default"] = __webpack_exports__["default"];
90
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
91
- "default"
92
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
93
- Object.defineProperty(exports, '__esModule', {
94
- value: true
95
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-compiler-loader/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC3B,CAAA;AAMD,wBAA8B,mBAAmB,CAAC,IAAI,KAAA,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,iBAiC1F"}
@@ -1,51 +0,0 @@
1
- import __rslib_shim_module__ from 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE__babel_core_1832d21b__ from "@babel/core";
4
- import * as __WEBPACK_EXTERNAL_MODULE__babel_plugin_proposal_decorators_ac6ac103__ from "@babel/plugin-proposal-decorators";
5
- import * as __WEBPACK_EXTERNAL_MODULE__babel_plugin_transform_class_properties_a153ae05__ from "@babel/plugin-transform-class-properties";
6
- import * as __WEBPACK_EXTERNAL_MODULE_babel_plugin_react_compiler_4f9bef75__ from "babel-plugin-react-compiler";
7
- const defaultBabelParsePlugins = [
8
- 'jsx',
9
- "typescript"
10
- ];
11
- async function reactCompilerLoader(input, _inputSourceMap) {
12
- const callback = this.async();
13
- try {
14
- const options = this.getOptions();
15
- const result = await __WEBPACK_EXTERNAL_MODULE__babel_core_1832d21b__.transformAsync(input, {
16
- sourceFileName: this.resourcePath,
17
- filename: this.resourcePath,
18
- cloneInputAst: false,
19
- plugins: [
20
- [
21
- __WEBPACK_EXTERNAL_MODULE_babel_plugin_react_compiler_4f9bef75__["default"],
22
- options
23
- ],
24
- [
25
- __WEBPACK_EXTERNAL_MODULE__babel_plugin_proposal_decorators_ac6ac103__["default"],
26
- {
27
- legacy: true
28
- }
29
- ],
30
- [
31
- __WEBPACK_EXTERNAL_MODULE__babel_plugin_transform_class_properties_a153ae05__["default"]
32
- ]
33
- ],
34
- parserOpts: {
35
- plugins: [
36
- ...defaultBabelParsePlugins
37
- ]
38
- },
39
- ast: false,
40
- sourceMaps: true,
41
- configFile: false,
42
- babelrc: false
43
- });
44
- if (!result) throw new TypeError('babel.transformAsync with react compiler plugin returns null');
45
- const { code, map } = result;
46
- callback(null, code ?? void 0, map ?? void 0);
47
- } catch (e) {
48
- callback(e);
49
- }
50
- }
51
- export { reactCompilerLoader as default };
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- applySplitChunksConfig: ()=>applySplitChunksConfig
28
- });
29
- const core_namespaceObject = require("@unpackjs/core");
30
- const applySplitChunksConfig = ({ config, unpackConfig })=>{
31
- if ('split-by-experience' !== unpackConfig.performance.chunkSplit.strategy) return config;
32
- const currentConfig = config.optimization.splitChunks;
33
- const extraGroups = {};
34
- extraGroups.react = {
35
- name: 'lib-react',
36
- test: (0, core_namespaceObject.isDevServer)() ? /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/,
37
- priority: 0
38
- };
39
- extraGroups.router = {
40
- name: 'lib-router',
41
- test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
42
- priority: 0
43
- };
44
- config.optimization.splitChunks = {
45
- ...currentConfig,
46
- cacheGroups: {
47
- ...extraGroups,
48
- ...currentConfig.cacheGroups
49
- }
50
- };
51
- return config;
52
- };
53
- exports.applySplitChunksConfig = __webpack_exports__.applySplitChunksConfig;
54
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
55
- "applySplitChunksConfig"
56
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
57
- Object.defineProperty(exports, '__esModule', {
58
- value: true
59
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"splitChunks.d.ts","sourceRoot":"","sources":["../src/splitChunks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAA;AAEvB,eAAO,MAAM,sBAAsB,8BAGhC;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,yCA2BA,CAAA"}
@@ -1,27 +0,0 @@
1
- import __rslib_shim_module__ from 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__ from "@unpackjs/core";
4
- const applySplitChunksConfig = ({ config, unpackConfig })=>{
5
- if ('split-by-experience' !== unpackConfig.performance.chunkSplit.strategy) return config;
6
- const currentConfig = config.optimization.splitChunks;
7
- const extraGroups = {};
8
- extraGroups.react = {
9
- name: 'lib-react',
10
- test: (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.isDevServer)() ? /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/,
11
- priority: 0
12
- };
13
- extraGroups.router = {
14
- name: 'lib-router',
15
- test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
16
- priority: 0
17
- };
18
- config.optimization.splitChunks = {
19
- ...currentConfig,
20
- cacheGroups: {
21
- ...extraGroups,
22
- ...currentConfig.cacheGroups
23
- }
24
- };
25
- return config;
26
- };
27
- export { applySplitChunksConfig };
File without changes
File without changes
File without changes