@bleedingdev/modern-js-ultramodern-app-tools 3.11.3-ultramodern.4 → 3.11.3-ultramodern.6
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/cjs/native-composition/module-federation-renderer-plugin.js +1 -1
- package/dist/cjs/native-composition/native-development.js +1 -1
- package/dist/cjs/native-composition/native-entry-command.js +3 -3
- package/dist/cjs/native-composition/native-infrastructure.js +1 -1
- package/dist/cjs/native-composition/native-module-federation.js +1 -1
- package/dist/cjs/native-composition/native-prerender.js +1 -1
- package/dist/cjs/native-composition/native-server-plugin.js +1 -1
- package/dist/cjs/native-composition/redact-config.js +3 -3
- package/dist/cjs/native-composition/renderer-profile.js +1 -1
- package/dist/cjs/native-composition/renderer-registration.js +1 -1
- package/dist/cjs/native-composition/server-plugin-resolution.js +1 -1
- package/dist/cjs/renderers/react/adapter.js +1 -1
- package/dist/cjs/renderers/react/build-metadata.js +1 -1
- package/dist/cjs/renderers/react/composition.js +1 -1
- package/dist/cjs/renderers/react/module-federation-recovery-plugin.js +1 -1
- package/dist/cjs/renderers/react/module-federation.js +1 -1
- package/dist/cjs/renderers/react/profile.js +6 -6
- package/dist/cjs/renderers/react/redact-integration-plugin.js +24 -47
- package/dist/cjs/renderers/react/router-bindings.js +4 -4
- package/dist/cjs/renderers/react/rsc-disabled-plugin.js +2 -2
- package/dist/esm/native-composition/native-prerender.mjs +1 -1
- package/dist/esm/renderers/react/adapter.mjs +1 -1
- package/dist/esm/renderers/react/profile.mjs +6 -6
- package/dist/esm/renderers/react/redact-integration-plugin.mjs +21 -47
- package/dist/esm/renderers/react/router-bindings.mjs +4 -4
- package/dist/esm-node/native-composition/native-prerender.mjs +1 -1
- package/dist/esm-node/renderers/react/adapter.mjs +1 -1
- package/dist/esm-node/renderers/react/profile.mjs +6 -6
- package/dist/esm-node/renderers/react/redact-integration-plugin.mjs +21 -47
- package/dist/esm-node/renderers/react/router-bindings.mjs +4 -4
- package/dist/types/renderers/react/redact-integration-plugin.d.ts +4 -3
- package/dist/types/renderers/react/types.d.ts +1 -1
- package/dist/types-esm/renderers/react/redact-integration-plugin.d.mts +4 -3
- package/dist/types-esm/renderers/react/types.d.mts +1 -1
- package/package.json +117 -46
- package/src/renderers/react/profile.ts +6 -6
- package/src/renderers/react/redact-integration-plugin.ts +59 -59
- package/src/renderers/react/router-bindings.ts +4 -4
- package/src/renderers/react/types.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -50,9 +50,9 @@ function nativeEntryCommandPlugin() {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
-
createRouteGenerationCommand:
|
|
55
|
-
nativeEntryCommandPlugin:
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
54
|
+
createRouteGenerationCommand: createRouteGenerationCommand,
|
|
55
|
+
nativeEntryCommandPlugin: nativeEntryCommandPlugin
|
|
56
56
|
});
|
|
57
57
|
exports.createRouteGenerationCommand = __webpack_exports__.createRouteGenerationCommand;
|
|
58
58
|
exports.nativeEntryCommandPlugin = __webpack_exports__.nativeEntryCommandPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -191,7 +191,7 @@ function markPrerenderedDocument(html) {
|
|
|
191
191
|
const marker = `<meta name="${data_namespaceObject.PRERENDERED_DOCUMENT_META}" content="static-data">`;
|
|
192
192
|
let close = -1;
|
|
193
193
|
let templates = 0;
|
|
194
|
-
for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s
|
|
194
|
+
for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s*>|<\x21--[\s\S]*?--\x3e|<\/(head|template)\s*>|<[a-z][^\s/>]*(?:"[^"]*"|'[^']*'|[^>"'])*>/giu)){
|
|
195
195
|
const token = match[0];
|
|
196
196
|
if (/^<template\b/iu.test(token)) templates += 1;
|
|
197
197
|
else if (match[2]?.toLowerCase() === 'template') templates = Math.max(0, templates - 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -36,9 +36,9 @@ function usesRedact(config) {
|
|
|
36
36
|
validateRedactConfig(config.redact);
|
|
37
37
|
return false !== config.redact && !config.server?.rsc;
|
|
38
38
|
}
|
|
39
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
-
usesRedact:
|
|
41
|
-
validateRedactConfig:
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
40
|
+
usesRedact: usesRedact,
|
|
41
|
+
validateRedactConfig: validateRedactConfig
|
|
42
42
|
});
|
|
43
43
|
exports.usesRedact = __webpack_exports__.usesRedact;
|
|
44
44
|
exports.validateRedactConfig = __webpack_exports__.validateRedactConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -31,7 +31,7 @@ const reactProfile = {
|
|
|
31
31
|
renderer: 'react',
|
|
32
32
|
status: 'stable',
|
|
33
33
|
protocolVersion: 1,
|
|
34
|
-
minimumNode: '26.
|
|
34
|
+
minimumNode: '26.13.1',
|
|
35
35
|
hmr: {
|
|
36
36
|
editedBoundary: 'may-reset',
|
|
37
37
|
unaffectedComponents: 'preserved',
|
|
@@ -49,9 +49,9 @@ const reactProfile = {
|
|
|
49
49
|
},
|
|
50
50
|
router: {
|
|
51
51
|
name: 'react-router',
|
|
52
|
-
version: '
|
|
52
|
+
version: '8.5.1',
|
|
53
53
|
coreName: 'react-router',
|
|
54
|
-
coreVersion: '
|
|
54
|
+
coreVersion: '8.5.1'
|
|
55
55
|
},
|
|
56
56
|
sourceExtensions: [
|
|
57
57
|
'.tsx',
|
|
@@ -63,14 +63,14 @@ const reactProfile = {
|
|
|
63
63
|
dependencies: {
|
|
64
64
|
react: '19.3.1',
|
|
65
65
|
'react-dom': '19.3.1',
|
|
66
|
-
'@modern-js/runtime': '3.
|
|
66
|
+
'@modern-js/runtime': '3.11.3',
|
|
67
67
|
'@modern-js/i18n-integration': '3.8.3',
|
|
68
68
|
'@modern-js/runtime-renderer-extensions': '3.8.3',
|
|
69
69
|
'@rsbuild/plugin-react': '2.1.1',
|
|
70
70
|
'@rsbuild/plugin-svgr': '2.0.5',
|
|
71
71
|
'@loadable/component': '5.16.7',
|
|
72
|
-
'react-helmet-async': '3.
|
|
73
|
-
'react-router': '
|
|
72
|
+
'react-helmet-async': '3.1.0',
|
|
73
|
+
'react-router': '8.5.1'
|
|
74
74
|
},
|
|
75
75
|
capabilities: {
|
|
76
76
|
worker: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ?
|
|
3
|
+
return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -47,6 +47,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
47
47
|
createRedactBuilderPlugin: ()=>createRedactBuilderPlugin,
|
|
48
48
|
mergeRedactAliases: ()=>mergeRedactAliases,
|
|
49
49
|
redactArtifactDigest: ()=>redactArtifactDigest,
|
|
50
|
+
redactRuntimeIdentity: ()=>redactRuntimeIdentity,
|
|
50
51
|
resolveRedactAliases: ()=>resolveRedactAliases,
|
|
51
52
|
ultramodernRedactIntegrationPlugin: ()=>ultramodernRedactIntegrationPlugin,
|
|
52
53
|
usesRedact: ()=>redact_config_js_namespaceObject.usesRedact,
|
|
@@ -57,9 +58,7 @@ const external_node_fs_namespaceObject = require("node:fs");
|
|
|
57
58
|
const external_node_module_namespaceObject = require("node:module");
|
|
58
59
|
const external_node_path_namespaceObject = require("node:path");
|
|
59
60
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
60
|
-
const external_node_url_namespaceObject = require("node:url");
|
|
61
61
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
62
|
-
const external_rsbuild_redact_plugin_namespaceObject = require("rsbuild-redact-plugin");
|
|
63
62
|
const redact_config_js_namespaceObject = require("../../native-composition/redact-config.js");
|
|
64
63
|
const renderer_installed_profile_js_namespaceObject = require("../../native-composition/renderer-installed-profile.js");
|
|
65
64
|
const REDACT_ALIASES = {
|
|
@@ -86,14 +85,17 @@ const REDACT_ALIASES = {
|
|
|
86
85
|
'use-sync-external-store/shim/with-selector.js': '@tanstack/redact'
|
|
87
86
|
};
|
|
88
87
|
const frameworkRequire = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
function redactRuntimeIdentity(require1 = frameworkRequire) {
|
|
89
|
+
const owner = (0, renderer_installed_profile_js_namespaceObject.readRendererFrameworkPackage)({
|
|
90
|
+
specifier: '@tanstack/redact',
|
|
91
|
+
filename: require1.resolve('@tanstack/redact')
|
|
92
|
+
});
|
|
93
|
+
return `${owner.name}@${owner.version}`;
|
|
94
|
+
}
|
|
93
95
|
const REDACT_PATCH_MARKER = '// ultramodern-redact-patch: v1';
|
|
94
|
-
function assertRedactPatch(read = external_node_fs_namespaceObject.readFileSync) {
|
|
95
|
-
const stream = external_node_path_default().join(external_node_path_default().dirname(
|
|
96
|
-
if (read(stream, 'utf8').split(/\r?\n/, 1)[0] !== REDACT_PATCH_MARKER) throw new Error(`[ultramodern]
|
|
96
|
+
function assertRedactPatch(read = external_node_fs_namespaceObject.readFileSync, require1 = frameworkRequire) {
|
|
97
|
+
const stream = external_node_path_default().join(external_node_path_default().dirname(require1.resolve('@tanstack/redact/server')), 'stream.js');
|
|
98
|
+
if (read(stream, 'utf8').split(/\r?\n/, 1)[0] !== REDACT_PATCH_MARKER) throw new Error(`[ultramodern] ${redactRuntimeIdentity(require1)} requires the UltraModern reviewed SSR patch (${REDACT_PATCH_MARKER}) in ${stream}. Install the framework's npm:@bleedingdev/tanstack-redact@0.3.2 dependency; unpatched Redact must not ship. Set redact: false to use real React instead.`);
|
|
97
99
|
}
|
|
98
100
|
function redactArtifactDigest(directory = external_node_path_default().resolve(external_node_path_default().dirname(frameworkRequire.resolve('@tanstack/redact')), '..')) {
|
|
99
101
|
const hash = (0, external_node_crypto_namespaceObject.createHash)('sha256');
|
|
@@ -168,6 +170,7 @@ function bundleRedactRuntime(externals) {
|
|
|
168
170
|
}
|
|
169
171
|
function createRedactBuilderPlugin(config, testing = {}) {
|
|
170
172
|
const enabled = (0, redact_config_js_namespaceObject.usesRedact)(config);
|
|
173
|
+
const require1 = testing.require ?? frameworkRequire;
|
|
171
174
|
return {
|
|
172
175
|
name: enabled ? 'ultramodern:react:redact' : 'ultramodern:react:runtime-cache',
|
|
173
176
|
setup (api) {
|
|
@@ -185,12 +188,12 @@ function createRedactBuilderPlugin(config, testing = {}) {
|
|
|
185
188
|
cacheDigest: [
|
|
186
189
|
...options.cacheDigest ?? [],
|
|
187
190
|
...enabled ? [
|
|
188
|
-
|
|
191
|
+
redactRuntimeIdentity(require1),
|
|
189
192
|
REDACT_PATCH_MARKER,
|
|
190
|
-
redactArtifactDigest(),
|
|
193
|
+
redactArtifactDigest(external_node_path_default().resolve(external_node_path_default().dirname(require1.resolve('@tanstack/redact')), '..')),
|
|
191
194
|
`redact-view-transitions:${viewTransitions}`
|
|
192
195
|
] : [
|
|
193
|
-
`react@${
|
|
196
|
+
`react@${require1('react/package.json').version}`,
|
|
194
197
|
'ultramodern:real-react-cache:v1'
|
|
195
198
|
]
|
|
196
199
|
]
|
|
@@ -199,47 +202,19 @@ function createRedactBuilderPlugin(config, testing = {}) {
|
|
|
199
202
|
};
|
|
200
203
|
});
|
|
201
204
|
if (!enabled) return;
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
const publicPlugin = (0, external_rsbuild_redact_plugin_namespaceObject.pluginRedact)({
|
|
205
|
-
resolveFrom: frameworkDirectory(),
|
|
206
|
-
viewTransitions
|
|
207
|
-
});
|
|
208
|
-
publicPlugin.setup({
|
|
209
|
-
...api,
|
|
210
|
-
modifyRspackConfig (hook) {
|
|
211
|
-
const handler = 'function' == typeof hook ? hook : hook.handler;
|
|
212
|
-
api.modifyRspackConfig({
|
|
213
|
-
order: 'post',
|
|
214
|
-
async handler (rspackConfig, utils) {
|
|
215
|
-
if (!isCsr()) return;
|
|
216
|
-
const isolated = {
|
|
217
|
-
...rspackConfig,
|
|
218
|
-
resolve: {
|
|
219
|
-
...rspackConfig.resolve,
|
|
220
|
-
alias: {}
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
await handler(isolated, utils);
|
|
224
|
-
if (Object.hasOwn(isolated.resolve.alias, 'react$')) publicApplied.add(rspackConfig);
|
|
225
|
-
rspackConfig.resolve ??= {};
|
|
226
|
-
rspackConfig.resolve.alias = mergeRedactAliases(rspackConfig.resolve.alias, isolated.resolve.alias);
|
|
227
|
-
rspackConfig.plugins = isolated.plugins;
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
});
|
|
205
|
+
const reactVersion = require1('react/package.json').version;
|
|
206
|
+
if ('string' != typeof reactVersion || !reactVersion.startsWith('19.')) throw new Error(`[ultramodern] Redact requires React 19; found ${String(reactVersion)}. Set redact: false to use real React instead.`);
|
|
232
207
|
api.modifyRspackConfig({
|
|
233
208
|
order: 'post',
|
|
234
209
|
handler (rspackConfig, { rspack, environment }) {
|
|
235
|
-
(testing.assertPatch ?? assertRedactPatch)();
|
|
236
|
-
const aliases = resolveRedactAliases();
|
|
210
|
+
(testing.assertPatch ?? (()=>assertRedactPatch(external_node_fs_namespaceObject.readFileSync, require1)))();
|
|
211
|
+
const aliases = resolveRedactAliases(require1);
|
|
237
212
|
rspackConfig.resolve ??= {};
|
|
238
213
|
rspackConfig.resolve.alias = mergeRedactAliases(rspackConfig.resolve.alias, aliases);
|
|
239
214
|
rspackConfig.externals = bundleRedactRuntime(rspackConfig.externals);
|
|
240
215
|
rspackConfig.plugins ??= [];
|
|
241
|
-
if (!
|
|
242
|
-
const feature = external_node_path_default().resolve(external_node_path_default().dirname(
|
|
216
|
+
if (!viewTransitions) {
|
|
217
|
+
const feature = external_node_path_default().resolve(external_node_path_default().dirname(require1.resolve('@tanstack/redact')), '../dom/features/view-transition/index.js');
|
|
243
218
|
rspackConfig.plugins.push(new rspack.NormalModuleReplacementPlugin(/[\\/]features[\\/]view-transition[\\/]index\.js$/, (data)=>{
|
|
244
219
|
if (data.createData?.resource === feature) data.createData.resource = external_node_path_default().join(external_node_path_default().dirname(feature), 'stub.js');
|
|
245
220
|
}));
|
|
@@ -280,6 +255,7 @@ exports.bundleRedactRuntime = __webpack_exports__.bundleRedactRuntime;
|
|
|
280
255
|
exports.createRedactBuilderPlugin = __webpack_exports__.createRedactBuilderPlugin;
|
|
281
256
|
exports.mergeRedactAliases = __webpack_exports__.mergeRedactAliases;
|
|
282
257
|
exports.redactArtifactDigest = __webpack_exports__.redactArtifactDigest;
|
|
258
|
+
exports.redactRuntimeIdentity = __webpack_exports__.redactRuntimeIdentity;
|
|
283
259
|
exports.resolveRedactAliases = __webpack_exports__.resolveRedactAliases;
|
|
284
260
|
exports.ultramodernRedactIntegrationPlugin = __webpack_exports__.ultramodernRedactIntegrationPlugin;
|
|
285
261
|
exports.usesRedact = __webpack_exports__.usesRedact;
|
|
@@ -292,6 +268,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
292
268
|
"createRedactBuilderPlugin",
|
|
293
269
|
"mergeRedactAliases",
|
|
294
270
|
"redactArtifactDigest",
|
|
271
|
+
"redactRuntimeIdentity",
|
|
295
272
|
"resolveRedactAliases",
|
|
296
273
|
"ultramodernRedactIntegrationPlugin",
|
|
297
274
|
"usesRedact",
|
|
@@ -51,16 +51,16 @@ const TANSTACK_OWNER = '@modern-js/plugin-tanstack';
|
|
|
51
51
|
const DECLARED_REACT_ROUTER = Object.freeze({
|
|
52
52
|
framework: 'react-router',
|
|
53
53
|
name: 'react-router',
|
|
54
|
-
version: '
|
|
54
|
+
version: '8.5.1',
|
|
55
55
|
coreName: 'react-router',
|
|
56
|
-
coreVersion: '
|
|
56
|
+
coreVersion: '8.5.1'
|
|
57
57
|
});
|
|
58
58
|
const DECLARED_TANSTACK_ROUTER = Object.freeze({
|
|
59
59
|
framework: 'tanstack',
|
|
60
60
|
name: '@tanstack/react-router',
|
|
61
|
-
version: '1.170.
|
|
61
|
+
version: '1.170.46',
|
|
62
62
|
coreName: '@tanstack/router-core',
|
|
63
|
-
coreVersion: '1.171.
|
|
63
|
+
coreVersion: '1.171.39'
|
|
64
64
|
});
|
|
65
65
|
function readInstalledPackage(fromDirectory, name) {
|
|
66
66
|
let manifestFile;
|
|
@@ -105,8 +105,8 @@ function rscDisabledRuntimePlugin() {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
109
|
-
rscDisabledRuntimePlugin:
|
|
108
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
109
|
+
rscDisabledRuntimePlugin: rscDisabledRuntimePlugin
|
|
110
110
|
});
|
|
111
111
|
exports.rscDisabledRuntimePlugin = __webpack_exports__.rscDisabledRuntimePlugin;
|
|
112
112
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -140,7 +140,7 @@ function markPrerenderedDocument(html) {
|
|
|
140
140
|
const marker = `<meta name="${PRERENDERED_DOCUMENT_META}" content="static-data">`;
|
|
141
141
|
let close = -1;
|
|
142
142
|
let templates = 0;
|
|
143
|
-
for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s
|
|
143
|
+
for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s*>|<\x21--[\s\S]*?--\x3e|<\/(head|template)\s*>|<[a-z][^\s/>]*(?:"[^"]*"|'[^']*'|[^>"'])*>/giu)){
|
|
144
144
|
const token = match[0];
|
|
145
145
|
if (/^<template\b/iu.test(token)) templates += 1;
|
|
146
146
|
else if (match[2]?.toLowerCase() === 'template') templates = Math.max(0, templates - 1);
|
|
@@ -2,7 +2,7 @@ const reactProfile = {
|
|
|
2
2
|
renderer: 'react',
|
|
3
3
|
status: 'stable',
|
|
4
4
|
protocolVersion: 1,
|
|
5
|
-
minimumNode: '26.
|
|
5
|
+
minimumNode: '26.13.1',
|
|
6
6
|
hmr: {
|
|
7
7
|
editedBoundary: 'may-reset',
|
|
8
8
|
unaffectedComponents: 'preserved',
|
|
@@ -20,9 +20,9 @@ const reactProfile = {
|
|
|
20
20
|
},
|
|
21
21
|
router: {
|
|
22
22
|
name: 'react-router',
|
|
23
|
-
version: '
|
|
23
|
+
version: '8.5.1',
|
|
24
24
|
coreName: 'react-router',
|
|
25
|
-
coreVersion: '
|
|
25
|
+
coreVersion: '8.5.1'
|
|
26
26
|
},
|
|
27
27
|
sourceExtensions: [
|
|
28
28
|
'.tsx',
|
|
@@ -34,14 +34,14 @@ const reactProfile = {
|
|
|
34
34
|
dependencies: {
|
|
35
35
|
react: '19.3.1',
|
|
36
36
|
'react-dom': '19.3.1',
|
|
37
|
-
'@modern-js/runtime': '3.
|
|
37
|
+
'@modern-js/runtime': '3.11.3',
|
|
38
38
|
'@modern-js/i18n-integration': '3.8.3',
|
|
39
39
|
'@modern-js/runtime-renderer-extensions': '3.8.3',
|
|
40
40
|
'@rsbuild/plugin-react': '2.1.1',
|
|
41
41
|
'@rsbuild/plugin-svgr': '2.0.5',
|
|
42
42
|
'@loadable/component': '5.16.7',
|
|
43
|
-
'react-helmet-async': '3.
|
|
44
|
-
'react-router': '
|
|
43
|
+
'react-helmet-async': '3.1.0',
|
|
44
|
+
'react-router': '8.5.1'
|
|
45
45
|
},
|
|
46
46
|
capabilities: {
|
|
47
47
|
worker: true,
|
|
@@ -2,9 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { readFileSync, readdirSync } from "node:fs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import node_path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
5
|
import { logger } from "@modern-js/utils";
|
|
7
|
-
import { pluginRedact } from "rsbuild-redact-plugin";
|
|
8
6
|
import { usesRedact, validateRedactConfig } from "../../native-composition/redact-config.mjs";
|
|
9
7
|
import { readRendererFrameworkPackage } from "../../native-composition/renderer-installed-profile.mjs";
|
|
10
8
|
const REDACT_ALIASES = {
|
|
@@ -31,14 +29,17 @@ const REDACT_ALIASES = {
|
|
|
31
29
|
'use-sync-external-store/shim/with-selector.js': '@tanstack/redact'
|
|
32
30
|
};
|
|
33
31
|
const frameworkRequire = createRequire(import.meta.url);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
function redactRuntimeIdentity(require = frameworkRequire) {
|
|
33
|
+
const owner = readRendererFrameworkPackage({
|
|
34
|
+
specifier: '@tanstack/redact',
|
|
35
|
+
filename: require.resolve('@tanstack/redact')
|
|
36
|
+
});
|
|
37
|
+
return `${owner.name}@${owner.version}`;
|
|
38
|
+
}
|
|
38
39
|
const REDACT_PATCH_MARKER = '// ultramodern-redact-patch: v1';
|
|
39
|
-
function assertRedactPatch(read = readFileSync) {
|
|
40
|
-
const stream = node_path.join(node_path.dirname(
|
|
41
|
-
if (read(stream, 'utf8').split(/\r?\n/, 1)[0] !== REDACT_PATCH_MARKER) throw new Error(`[ultramodern]
|
|
40
|
+
function assertRedactPatch(read = readFileSync, require = frameworkRequire) {
|
|
41
|
+
const stream = node_path.join(node_path.dirname(require.resolve('@tanstack/redact/server')), 'stream.js');
|
|
42
|
+
if (read(stream, 'utf8').split(/\r?\n/, 1)[0] !== REDACT_PATCH_MARKER) throw new Error(`[ultramodern] ${redactRuntimeIdentity(require)} requires the UltraModern reviewed SSR patch (${REDACT_PATCH_MARKER}) in ${stream}. Install the framework's npm:@bleedingdev/tanstack-redact@0.3.2 dependency; unpatched Redact must not ship. Set redact: false to use real React instead.`);
|
|
42
43
|
}
|
|
43
44
|
function redactArtifactDigest(directory = node_path.resolve(node_path.dirname(frameworkRequire.resolve('@tanstack/redact')), '..')) {
|
|
44
45
|
const hash = createHash('sha256');
|
|
@@ -113,6 +114,7 @@ function bundleRedactRuntime(externals) {
|
|
|
113
114
|
}
|
|
114
115
|
function createRedactBuilderPlugin(config, testing = {}) {
|
|
115
116
|
const enabled = usesRedact(config);
|
|
117
|
+
const require = testing.require ?? frameworkRequire;
|
|
116
118
|
return {
|
|
117
119
|
name: enabled ? 'ultramodern:react:redact' : 'ultramodern:react:runtime-cache',
|
|
118
120
|
setup (api) {
|
|
@@ -130,12 +132,12 @@ function createRedactBuilderPlugin(config, testing = {}) {
|
|
|
130
132
|
cacheDigest: [
|
|
131
133
|
...options.cacheDigest ?? [],
|
|
132
134
|
...enabled ? [
|
|
133
|
-
|
|
135
|
+
redactRuntimeIdentity(require),
|
|
134
136
|
REDACT_PATCH_MARKER,
|
|
135
|
-
redactArtifactDigest(),
|
|
137
|
+
redactArtifactDigest(node_path.resolve(node_path.dirname(require.resolve('@tanstack/redact')), '..')),
|
|
136
138
|
`redact-view-transitions:${viewTransitions}`
|
|
137
139
|
] : [
|
|
138
|
-
`react@${
|
|
140
|
+
`react@${require('react/package.json').version}`,
|
|
139
141
|
'ultramodern:real-react-cache:v1'
|
|
140
142
|
]
|
|
141
143
|
]
|
|
@@ -144,47 +146,19 @@ function createRedactBuilderPlugin(config, testing = {}) {
|
|
|
144
146
|
};
|
|
145
147
|
});
|
|
146
148
|
if (!enabled) return;
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
const publicPlugin = pluginRedact({
|
|
150
|
-
resolveFrom: frameworkDirectory(),
|
|
151
|
-
viewTransitions
|
|
152
|
-
});
|
|
153
|
-
publicPlugin.setup({
|
|
154
|
-
...api,
|
|
155
|
-
modifyRspackConfig (hook) {
|
|
156
|
-
const handler = 'function' == typeof hook ? hook : hook.handler;
|
|
157
|
-
api.modifyRspackConfig({
|
|
158
|
-
order: 'post',
|
|
159
|
-
async handler (rspackConfig, utils) {
|
|
160
|
-
if (!isCsr()) return;
|
|
161
|
-
const isolated = {
|
|
162
|
-
...rspackConfig,
|
|
163
|
-
resolve: {
|
|
164
|
-
...rspackConfig.resolve,
|
|
165
|
-
alias: {}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
await handler(isolated, utils);
|
|
169
|
-
if (Object.hasOwn(isolated.resolve.alias, 'react$')) publicApplied.add(rspackConfig);
|
|
170
|
-
rspackConfig.resolve ??= {};
|
|
171
|
-
rspackConfig.resolve.alias = mergeRedactAliases(rspackConfig.resolve.alias, isolated.resolve.alias);
|
|
172
|
-
rspackConfig.plugins = isolated.plugins;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
});
|
|
149
|
+
const reactVersion = require('react/package.json').version;
|
|
150
|
+
if ('string' != typeof reactVersion || !reactVersion.startsWith('19.')) throw new Error(`[ultramodern] Redact requires React 19; found ${String(reactVersion)}. Set redact: false to use real React instead.`);
|
|
177
151
|
api.modifyRspackConfig({
|
|
178
152
|
order: 'post',
|
|
179
153
|
handler (rspackConfig, { rspack, environment }) {
|
|
180
|
-
(testing.assertPatch ?? assertRedactPatch)();
|
|
181
|
-
const aliases = resolveRedactAliases();
|
|
154
|
+
(testing.assertPatch ?? (()=>assertRedactPatch(readFileSync, require)))();
|
|
155
|
+
const aliases = resolveRedactAliases(require);
|
|
182
156
|
rspackConfig.resolve ??= {};
|
|
183
157
|
rspackConfig.resolve.alias = mergeRedactAliases(rspackConfig.resolve.alias, aliases);
|
|
184
158
|
rspackConfig.externals = bundleRedactRuntime(rspackConfig.externals);
|
|
185
159
|
rspackConfig.plugins ??= [];
|
|
186
|
-
if (!
|
|
187
|
-
const feature = node_path.resolve(node_path.dirname(
|
|
160
|
+
if (!viewTransitions) {
|
|
161
|
+
const feature = node_path.resolve(node_path.dirname(require.resolve('@tanstack/redact')), '../dom/features/view-transition/index.js');
|
|
188
162
|
rspackConfig.plugins.push(new rspack.NormalModuleReplacementPlugin(/[\\/]features[\\/]view-transition[\\/]index\.js$/, (data)=>{
|
|
189
163
|
if (data.createData?.resource === feature) data.createData.resource = node_path.join(node_path.dirname(feature), 'stub.js');
|
|
190
164
|
}));
|
|
@@ -218,4 +192,4 @@ const ultramodernRedactIntegrationPlugin = ()=>({
|
|
|
218
192
|
});
|
|
219
193
|
}
|
|
220
194
|
});
|
|
221
|
-
export { REDACT_ALIASES, REDACT_PATCH_MARKER, assertRedactPatch, bundleRedactRuntime, createRedactBuilderPlugin, mergeRedactAliases, redactArtifactDigest, resolveRedactAliases, ultramodernRedactIntegrationPlugin, usesRedact, validateRedactConfig };
|
|
195
|
+
export { REDACT_ALIASES, REDACT_PATCH_MARKER, assertRedactPatch, bundleRedactRuntime, createRedactBuilderPlugin, mergeRedactAliases, redactArtifactDigest, redactRuntimeIdentity, resolveRedactAliases, ultramodernRedactIntegrationPlugin, usesRedact, validateRedactConfig };
|
|
@@ -8,16 +8,16 @@ const TANSTACK_OWNER = '@modern-js/plugin-tanstack';
|
|
|
8
8
|
const DECLARED_REACT_ROUTER = Object.freeze({
|
|
9
9
|
framework: 'react-router',
|
|
10
10
|
name: 'react-router',
|
|
11
|
-
version: '
|
|
11
|
+
version: '8.5.1',
|
|
12
12
|
coreName: 'react-router',
|
|
13
|
-
coreVersion: '
|
|
13
|
+
coreVersion: '8.5.1'
|
|
14
14
|
});
|
|
15
15
|
const DECLARED_TANSTACK_ROUTER = Object.freeze({
|
|
16
16
|
framework: 'tanstack',
|
|
17
17
|
name: '@tanstack/react-router',
|
|
18
|
-
version: '1.170.
|
|
18
|
+
version: '1.170.46',
|
|
19
19
|
coreName: '@tanstack/router-core',
|
|
20
|
-
coreVersion: '1.171.
|
|
20
|
+
coreVersion: '1.171.39'
|
|
21
21
|
});
|
|
22
22
|
function readInstalledPackage(fromDirectory, name) {
|
|
23
23
|
let manifestFile;
|
|
@@ -141,7 +141,7 @@ function markPrerenderedDocument(html) {
|
|
|
141
141
|
const marker = `<meta name="${PRERENDERED_DOCUMENT_META}" content="static-data">`;
|
|
142
142
|
let close = -1;
|
|
143
143
|
let templates = 0;
|
|
144
|
-
for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s
|
|
144
|
+
for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s*>|<\x21--[\s\S]*?--\x3e|<\/(head|template)\s*>|<[a-z][^\s/>]*(?:"[^"]*"|'[^']*'|[^>"'])*>/giu)){
|
|
145
145
|
const token = match[0];
|
|
146
146
|
if (/^<template\b/iu.test(token)) templates += 1;
|
|
147
147
|
else if (match[2]?.toLowerCase() === 'template') templates = Math.max(0, templates - 1);
|