@unpackjs/plugin-react 2.1.0 → 2.2.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.cjs +182 -81
- package/dist/index.js +155 -41
- package/dist/injectScript.js +82 -0
- package/{dist → dist-types}/index.d.ts +0 -1
- package/dist-types/index.d.ts.map +1 -0
- package/{dist → dist-types}/mpa.d.ts.map +1 -1
- package/package.json +8 -11
- package/dist/click-to-component/index.cjs +0 -110
- package/dist/click-to-component/index.js +0 -68
- package/dist/click-to-component/injectScript.js +0 -116
- package/dist/index.d.ts.map +0 -1
- package/dist/mpa.cjs +0 -152
- package/dist/mpa.js +0 -109
- package/dist/react-compiler-loader/index.cjs +0 -95
- package/dist/react-compiler-loader/index.d.ts +0 -5
- package/dist/react-compiler-loader/index.d.ts.map +0 -1
- package/dist/react-compiler-loader/index.js +0 -51
- package/dist/splitChunks.cjs +0 -59
- package/dist/splitChunks.js +0 -27
- /package/{dist → dist-types}/click-to-component/index.d.ts +0 -0
- /package/{dist → dist-types}/click-to-component/index.d.ts.map +0 -0
- /package/{dist → dist-types}/mpa.d.ts +0 -0
- /package/{dist → dist-types}/splitChunks.d.ts +0 -0
- /package/{dist → dist-types}/splitChunks.d.ts.map +0 -0
|
@@ -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 'module';
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { transformAsync } from "@babel/core";
|
|
4
|
-
import plugin_proposal_decorators from "@babel/plugin-proposal-decorators";
|
|
5
|
-
import plugin_transform_class_properties from "@babel/plugin-transform-class-properties";
|
|
6
|
-
import babel_plugin_react_compiler 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 transformAsync(input, {
|
|
16
|
-
sourceFileName: this.resourcePath,
|
|
17
|
-
filename: this.resourcePath,
|
|
18
|
-
cloneInputAst: false,
|
|
19
|
-
plugins: [
|
|
20
|
-
[
|
|
21
|
-
babel_plugin_react_compiler,
|
|
22
|
-
options
|
|
23
|
-
],
|
|
24
|
-
[
|
|
25
|
-
plugin_proposal_decorators,
|
|
26
|
-
{
|
|
27
|
-
legacy: true
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
[
|
|
31
|
-
plugin_transform_class_properties
|
|
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 };
|
package/dist/splitChunks.cjs
DELETED
|
@@ -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
|
-
});
|
package/dist/splitChunks.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import 'module';
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { isDevServer } 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: 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
|
|
File without changes
|
|
File without changes
|