@shopify/hydrogen 1.2.0 → 1.3.2
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/README.md +1 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.js +6 -0
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +1 -1
- package/dist/esnext/components/CartProvider/cart-queries.js +1 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +2 -2
- package/dist/esnext/components/Image/Image.d.ts +1 -1
- package/dist/esnext/components/Image/Image.js +4 -4
- package/dist/esnext/components/Image/index.d.ts +1 -1
- package/dist/esnext/components/index.d.ts +1 -1
- package/dist/esnext/components/index.js +1 -1
- package/dist/esnext/constants.d.ts +1 -0
- package/dist/esnext/constants.js +1 -0
- package/dist/esnext/entry-client.js +1 -1
- package/dist/esnext/entry-server.js +30 -28
- package/dist/esnext/experimental.d.ts +1 -0
- package/dist/esnext/experimental.js +1 -0
- package/dist/esnext/foundation/Cache/cache.js +0 -1
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts +1 -0
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +1 -0
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +4 -2
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +17 -16
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -3
- package/dist/esnext/foundation/fetchSync/ResponseSync.d.ts +2 -1
- package/dist/esnext/foundation/fetchSync/ResponseSync.js +14 -2
- package/dist/esnext/foundation/session/session-types.d.ts +2 -0
- package/dist/esnext/foundation/session/session.d.ts +3 -0
- package/dist/esnext/foundation/session/session.js +16 -0
- package/dist/esnext/foundation/useQuery/hooks.d.ts +3 -0
- package/dist/esnext/foundation/useQuery/hooks.js +1 -1
- package/dist/esnext/foundation/useSession/useSession.d.ts +1 -0
- package/dist/esnext/foundation/useSession/useSession.js +13 -0
- package/dist/esnext/framework/plugin.js +6 -5
- package/dist/esnext/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-assets-version.js +12 -0
- package/dist/esnext/framework/plugins/vite-plugin-client-imports.js +6 -3
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-rsc.js +8 -5
- package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.js +7 -1
- package/dist/{node/framework/plugins/vite-plugin-purge-query-cache.d.ts → esnext/framework/plugins/vite-plugin-hydrogen-client-components-cache.d.ts} +1 -1
- package/dist/esnext/framework/plugins/{vite-plugin-hydrogen-client-middleware.js → vite-plugin-hydrogen-client-components-cache.js} +2 -2
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +104 -90
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -6
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +5 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +45 -7
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +14 -1
- package/dist/esnext/framework/plugins/vite-plugin-ssr-interop.js +5 -1
- package/dist/esnext/framework/types.d.ts +1 -0
- package/dist/esnext/framework/viteception.js +7 -1
- package/dist/esnext/storefront-api-types.d.ts +38 -31
- package/dist/esnext/storefront-api-types.js +4 -2
- package/dist/esnext/types.d.ts +2 -1
- package/dist/esnext/utilities/apiRoutes.d.ts +2 -0
- package/dist/esnext/utilities/apiRoutes.js +12 -1
- package/dist/esnext/utilities/fetch.js +4 -1
- package/dist/esnext/utilities/log/log.js +20 -5
- package/dist/esnext/utilities/log/utils.js +1 -1
- package/dist/esnext/utilities/template.d.ts +7 -6
- package/dist/esnext/utilities/template.js +39 -1
- package/dist/esnext/utilities/vite.d.ts +1 -0
- package/dist/esnext/utilities/vite.js +4 -0
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/foundation/session/session-types.d.ts +2 -0
- package/dist/node/framework/plugin.js +6 -5
- package/dist/node/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-assets-version.js +15 -0
- package/dist/node/framework/plugins/vite-plugin-client-imports.js +6 -3
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +3 -0
- package/dist/node/framework/plugins/vite-plugin-css-rsc.js +8 -5
- package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.js +7 -1
- package/dist/{esnext/framework/plugins/vite-plugin-purge-query-cache.d.ts → node/framework/plugins/vite-plugin-hydrogen-client-components-cache.d.ts} +1 -1
- package/dist/node/framework/plugins/{vite-plugin-hydrogen-client-middleware.js → vite-plugin-hydrogen-client-components-cache.js} +2 -2
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +107 -90
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -6
- package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +5 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +45 -7
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +14 -1
- package/dist/node/framework/plugins/vite-plugin-ssr-interop.js +5 -1
- package/dist/node/framework/types.d.ts +1 -0
- package/dist/node/framework/viteception.js +7 -1
- package/dist/node/utilities/vite.d.ts +1 -0
- package/dist/node/utilities/vite.js +30 -0
- package/package.json +7 -6
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +36 -25
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +105 -29
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +30 -29
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +92 -29
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +31 -29
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +29 -18
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +105 -29
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +92 -29
- package/vendor/react-server-dom-vite/package.json +2 -2
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +0 -9
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.js +0 -11
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +0 -9
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.js +0 -16
package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js
CHANGED
|
@@ -234,6 +234,11 @@ function processModelChunk(request, id, model) {
|
|
|
234
234
|
var row = serializeRowHeader('J', id) + json + '\n';
|
|
235
235
|
return stringToChunk(row);
|
|
236
236
|
}
|
|
237
|
+
function processReferenceChunk(request, id, reference) {
|
|
238
|
+
var json = stringify(reference);
|
|
239
|
+
var row = serializeRowHeader('J', id) + json + '\n';
|
|
240
|
+
return stringToChunk(row);
|
|
241
|
+
}
|
|
237
242
|
function processModuleChunk(request, id, moduleMetaData) {
|
|
238
243
|
var json = stringify(moduleMetaData);
|
|
239
244
|
var row = serializeRowHeader('M', id) + json + '\n';
|
|
@@ -576,6 +581,7 @@ var startInlineScript = stringToPrecomputedChunk('<script>');
|
|
|
576
581
|
var endInlineScript = stringToPrecomputedChunk('</script>');
|
|
577
582
|
var startScriptSrc = stringToPrecomputedChunk('<script src="');
|
|
578
583
|
var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
|
|
584
|
+
var scriptIntegirty = stringToPrecomputedChunk('" integrity="');
|
|
579
585
|
var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
|
|
580
586
|
|
|
581
587
|
var textSeparator = stringToPrecomputedChunk('<!-- -->');
|
|
@@ -1053,6 +1059,10 @@ function getOrCreateServerContext(globalName) {
|
|
|
1053
1059
|
return ContextRegistry[globalName];
|
|
1054
1060
|
}
|
|
1055
1061
|
|
|
1062
|
+
var PENDING = 0;
|
|
1063
|
+
var COMPLETED = 1;
|
|
1064
|
+
var ABORTED = 3;
|
|
1065
|
+
var ERRORED = 4;
|
|
1056
1066
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1057
1067
|
|
|
1058
1068
|
function defaultErrorHandler(error) {
|
|
@@ -1063,7 +1073,8 @@ var OPEN = 0;
|
|
|
1063
1073
|
var CLOSING = 1;
|
|
1064
1074
|
var CLOSED = 2;
|
|
1065
1075
|
function createRequest(model, bundlerConfig, onError, context, identifierPrefix) {
|
|
1066
|
-
var
|
|
1076
|
+
var abortSet = new Set();
|
|
1077
|
+
var pingedTasks = [];
|
|
1067
1078
|
var request = {
|
|
1068
1079
|
status: OPEN,
|
|
1069
1080
|
fatalError: null,
|
|
@@ -1072,7 +1083,8 @@ function createRequest(model, bundlerConfig, onError, context, identifierPrefix)
|
|
|
1072
1083
|
cache: new Map(),
|
|
1073
1084
|
nextChunkId: 0,
|
|
1074
1085
|
pendingChunks: 0,
|
|
1075
|
-
|
|
1086
|
+
abortableTasks: abortSet,
|
|
1087
|
+
pingedTasks: pingedTasks,
|
|
1076
1088
|
completedModuleChunks: [],
|
|
1077
1089
|
completedJSONChunks: [],
|
|
1078
1090
|
completedErrorChunks: [],
|
|
@@ -1088,8 +1100,8 @@ function createRequest(model, bundlerConfig, onError, context, identifierPrefix)
|
|
|
1088
1100
|
};
|
|
1089
1101
|
request.pendingChunks++;
|
|
1090
1102
|
var rootContext = createRootContext(context);
|
|
1091
|
-
var
|
|
1092
|
-
|
|
1103
|
+
var rootTask = createTask(request, model, rootContext, abortSet);
|
|
1104
|
+
pingedTasks.push(rootTask);
|
|
1093
1105
|
return request;
|
|
1094
1106
|
}
|
|
1095
1107
|
|
|
@@ -1187,28 +1199,30 @@ function attemptResolveElement(type, key, ref, props) {
|
|
|
1187
1199
|
throw new Error("Unsupported server component type: " + describeValueForErrorMessage(type));
|
|
1188
1200
|
}
|
|
1189
1201
|
|
|
1190
|
-
function
|
|
1191
|
-
var
|
|
1192
|
-
|
|
1202
|
+
function pingTask(request, task) {
|
|
1203
|
+
var pingedTasks = request.pingedTasks;
|
|
1204
|
+
pingedTasks.push(task);
|
|
1193
1205
|
|
|
1194
|
-
if (
|
|
1206
|
+
if (pingedTasks.length === 1) {
|
|
1195
1207
|
scheduleWork(function () {
|
|
1196
1208
|
return performWork(request);
|
|
1197
1209
|
});
|
|
1198
1210
|
}
|
|
1199
1211
|
}
|
|
1200
1212
|
|
|
1201
|
-
function
|
|
1213
|
+
function createTask(request, model, context, abortSet) {
|
|
1202
1214
|
var id = request.nextChunkId++;
|
|
1203
|
-
var
|
|
1215
|
+
var task = {
|
|
1204
1216
|
id: id,
|
|
1217
|
+
status: PENDING,
|
|
1205
1218
|
model: model,
|
|
1206
1219
|
context: context,
|
|
1207
1220
|
ping: function () {
|
|
1208
|
-
return
|
|
1221
|
+
return pingTask(request, task);
|
|
1209
1222
|
}
|
|
1210
1223
|
};
|
|
1211
|
-
|
|
1224
|
+
abortSet.add(task);
|
|
1225
|
+
return task;
|
|
1212
1226
|
}
|
|
1213
1227
|
|
|
1214
1228
|
function serializeByValueID(id) {
|
|
@@ -1443,12 +1457,12 @@ function resolveModelToJSON(request, parent, key, value) {
|
|
|
1443
1457
|
}
|
|
1444
1458
|
} catch (x) {
|
|
1445
1459
|
if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
|
|
1446
|
-
// Something suspended, we'll need to create a new
|
|
1460
|
+
// Something suspended, we'll need to create a new task and resolve it later.
|
|
1447
1461
|
request.pendingChunks++;
|
|
1448
|
-
var
|
|
1449
|
-
var ping =
|
|
1462
|
+
var newTask = createTask(request, value, getActiveContext(), request.abortableTasks);
|
|
1463
|
+
var ping = newTask.ping;
|
|
1450
1464
|
x.then(ping, ping);
|
|
1451
|
-
return serializeByRefID(
|
|
1465
|
+
return serializeByRefID(newTask.id);
|
|
1452
1466
|
} else {
|
|
1453
1467
|
logRecoverableError(request, x); // Something errored. We'll still send everything we have up until this point.
|
|
1454
1468
|
// We'll replace this element with a lazy reference that throws on the client
|
|
@@ -1656,34 +1670,43 @@ function emitProviderChunk(request, id, contextName) {
|
|
|
1656
1670
|
request.completedJSONChunks.push(processedChunk);
|
|
1657
1671
|
}
|
|
1658
1672
|
|
|
1659
|
-
function
|
|
1660
|
-
|
|
1673
|
+
function retryTask(request, task) {
|
|
1674
|
+
if (task.status !== PENDING) {
|
|
1675
|
+
// We completed this by other means before we had a chance to retry it.
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
switchContext(task.context);
|
|
1661
1680
|
|
|
1662
1681
|
try {
|
|
1663
|
-
var _value3 =
|
|
1682
|
+
var _value3 = task.model;
|
|
1664
1683
|
|
|
1665
1684
|
while (typeof _value3 === 'object' && _value3 !== null && _value3.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1666
1685
|
// TODO: Concatenate keys of parents onto children.
|
|
1667
1686
|
var element = _value3; // Attempt to render the server component.
|
|
1668
|
-
// Doing this here lets us reuse this same
|
|
1687
|
+
// Doing this here lets us reuse this same task if the next component
|
|
1669
1688
|
// also suspends.
|
|
1670
1689
|
|
|
1671
|
-
|
|
1690
|
+
task.model = _value3;
|
|
1672
1691
|
_value3 = attemptResolveElement(element.type, element.key, element.ref, element.props);
|
|
1673
1692
|
}
|
|
1674
1693
|
|
|
1675
|
-
var processedChunk = processModelChunk(request,
|
|
1694
|
+
var processedChunk = processModelChunk(request, task.id, _value3);
|
|
1676
1695
|
request.completedJSONChunks.push(processedChunk);
|
|
1696
|
+
request.abortableTasks.delete(task);
|
|
1697
|
+
task.status = COMPLETED;
|
|
1677
1698
|
} catch (x) {
|
|
1678
1699
|
if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
|
|
1679
1700
|
// Something suspended again, let's pick it back up later.
|
|
1680
|
-
var ping =
|
|
1701
|
+
var ping = task.ping;
|
|
1681
1702
|
x.then(ping, ping);
|
|
1682
1703
|
return;
|
|
1683
1704
|
} else {
|
|
1705
|
+
request.abortableTasks.delete(task);
|
|
1706
|
+
task.status = ERRORED;
|
|
1684
1707
|
logRecoverableError(request, x); // This errored, we need to serialize this error to the
|
|
1685
1708
|
|
|
1686
|
-
emitErrorChunk(request,
|
|
1709
|
+
emitErrorChunk(request, task.id, x);
|
|
1687
1710
|
}
|
|
1688
1711
|
}
|
|
1689
1712
|
}
|
|
@@ -1696,12 +1719,12 @@ function performWork(request) {
|
|
|
1696
1719
|
prepareToUseHooksForRequest(request);
|
|
1697
1720
|
|
|
1698
1721
|
try {
|
|
1699
|
-
var
|
|
1700
|
-
request.
|
|
1722
|
+
var pingedTasks = request.pingedTasks;
|
|
1723
|
+
request.pingedTasks = [];
|
|
1701
1724
|
|
|
1702
|
-
for (var i = 0; i <
|
|
1703
|
-
var
|
|
1704
|
-
|
|
1725
|
+
for (var i = 0; i < pingedTasks.length; i++) {
|
|
1726
|
+
var task = pingedTasks[i];
|
|
1727
|
+
retryTask(request, task);
|
|
1705
1728
|
}
|
|
1706
1729
|
|
|
1707
1730
|
if (request.destination !== null) {
|
|
@@ -1717,6 +1740,15 @@ function performWork(request) {
|
|
|
1717
1740
|
}
|
|
1718
1741
|
}
|
|
1719
1742
|
|
|
1743
|
+
function abortTask(task, request, errorId) {
|
|
1744
|
+
task.status = ABORTED; // Instead of emitting an error per task.id, we emit a model that only
|
|
1745
|
+
// has a single value referencing the error.
|
|
1746
|
+
|
|
1747
|
+
var ref = serializeByValueID(errorId);
|
|
1748
|
+
var processedChunk = processReferenceChunk(request, task.id, ref);
|
|
1749
|
+
request.completedJSONChunks.push(processedChunk);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1720
1752
|
function flushCompletedChunks(request, destination) {
|
|
1721
1753
|
beginWriting();
|
|
1722
1754
|
|
|
@@ -1818,6 +1850,34 @@ function startFlowing(request, destination) {
|
|
|
1818
1850
|
logRecoverableError(request, error);
|
|
1819
1851
|
fatalError(request, error);
|
|
1820
1852
|
}
|
|
1853
|
+
} // This is called to early terminate a request. It creates an error at all pending tasks.
|
|
1854
|
+
|
|
1855
|
+
function abort(request, reason) {
|
|
1856
|
+
try {
|
|
1857
|
+
var abortableTasks = request.abortableTasks;
|
|
1858
|
+
|
|
1859
|
+
if (abortableTasks.size > 0) {
|
|
1860
|
+
// We have tasks to abort. We'll emit one error row and then emit a reference
|
|
1861
|
+
// to that row from every row that's still remaining.
|
|
1862
|
+
var _error = reason === undefined ? new Error('The render was aborted by the server without a reason.') : reason;
|
|
1863
|
+
|
|
1864
|
+
logRecoverableError(request, _error);
|
|
1865
|
+
request.pendingChunks++;
|
|
1866
|
+
var errorId = request.nextChunkId++;
|
|
1867
|
+
emitErrorChunk(request, errorId, _error);
|
|
1868
|
+
abortableTasks.forEach(function (task) {
|
|
1869
|
+
return abortTask(task, request, errorId);
|
|
1870
|
+
});
|
|
1871
|
+
abortableTasks.clear();
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
if (request.destination !== null) {
|
|
1875
|
+
flushCompletedChunks(request, request.destination);
|
|
1876
|
+
}
|
|
1877
|
+
} catch (error) {
|
|
1878
|
+
logRecoverableError(request, error);
|
|
1879
|
+
fatalError(request, error);
|
|
1880
|
+
}
|
|
1821
1881
|
}
|
|
1822
1882
|
|
|
1823
1883
|
function importServerContexts(contexts) {
|
|
@@ -1873,6 +1933,9 @@ function renderToPipeableStream(model, options) {
|
|
|
1873
1933
|
startFlowing(request, destination);
|
|
1874
1934
|
destination.on('drain', createDrainHandler(destination, request));
|
|
1875
1935
|
return destination;
|
|
1936
|
+
},
|
|
1937
|
+
abort: function (reason) {
|
|
1938
|
+
abort(request, reason);
|
|
1876
1939
|
}
|
|
1877
1940
|
};
|
|
1878
1941
|
}
|
package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
'use strict';var e=require("react"),aa=require("util"),ba=Object.assign,h=null,k=0,
|
|
10
|
+
'use strict';var e=require("react"),aa=require("util"),ba=Object.assign,h=null,k=0,n=!0;function q(a,b){a=a.write(b);n=n&&a}
|
|
11
11
|
function r(a,b){if("string"===typeof b){if(0!==b.length)if(2048<3*b.length)0<k&&(q(a,h.subarray(0,k)),h=new Uint8Array(2048),k=0),q(a,u.encode(b));else{var d=h;0<k&&(d=h.subarray(k));d=u.encodeInto(b,d);var c=d.read;k+=d.written;c<b.length&&(q(a,h),h=new Uint8Array(2048),k=u.encodeInto(b.slice(c),h).written);2048===k&&(q(a,h),h=new Uint8Array(2048),k=0)}}else 0!==b.byteLength&&(2048<b.byteLength?(0<k&&(q(a,h.subarray(0,k)),h=new Uint8Array(2048),k=0),q(a,b)):(d=h.length-k,d<b.byteLength&&(0===d?q(a,
|
|
12
|
-
h):(h.set(b.subarray(0,d),k),k+=d,q(a,h),b=b.subarray(d)),h=new Uint8Array(2048),k=0),h.set(b,k),k+=b.byteLength,2048===k&&(q(a,h),h=new Uint8Array(2048),k=0)));return
|
|
12
|
+
h):(h.set(b.subarray(0,d),k),k+=d,q(a,h),b=b.subarray(d)),h=new Uint8Array(2048),k=0),h.set(b,k),k+=b.byteLength,2048===k&&(q(a,h),h=new Uint8Array(2048),k=0)));return n}var u=new aa.TextEncoder;function v(a){return u.encode(a)}var x=JSON.stringify,ca=Symbol.for("react.module.reference");function y(a){return"string"===typeof a?!!globalThis.__STRING_REFERENCE_INDEX[a]:a.$$typeof===ca}
|
|
13
13
|
var z=Symbol.for("react.element"),da=Symbol.for("react.fragment"),A=Symbol.for("react.provider"),ea=Symbol.for("react.forward_ref"),fa=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),C=Symbol.for("react.default_value");function D(a,b,d,c,f,g,l){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=f;this.mustUseProperty=d;this.propertyName=a;this.type=b;this.sanitizeURL=g;this.removeEmptyString=l}var E="children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ");
|
|
14
14
|
E.push("innerText","textContent");E.forEach(function(a){new D(a,0,!1,a,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){new D(a[0],1,!1,a[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){new D(a,2,!1,a.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){new D(a,2,!1,a,null,!1,!1)});
|
|
15
15
|
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){new D(a,3,!1,a.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(a){new D(a,3,!0,a,null,!1,!1)});["capture","download"].forEach(function(a){new D(a,4,!1,a,null,!1,!1)});
|
|
@@ -18,30 +18,32 @@ E.push("innerText","textContent");E.forEach(function(a){new D(a,0,!1,a,null,!1,!
|
|
|
18
18
|
G);new D(b,1,!1,a,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(F,G);new D(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(F,G);new D(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(a){new D(a,1,!1,a.toLowerCase(),null,!1,!1)});
|
|
19
19
|
new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(a){new D(a,1,!1,a.toLowerCase(),null,!0,!0)});
|
|
20
20
|
var H={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,
|
|
21
|
-
fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ha=["Webkit","ms","Moz","O"];Object.keys(H).forEach(function(a){ha.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);H[b]=H[a]})});var
|
|
22
|
-
v("/>");v(' selected=""');v("\n");v("<!DOCTYPE html>");v("</");v(">");v('<template id="');v('"></template>');v("\x3c!--$--\x3e");v('\x3c!--$?--\x3e<template id="');v('"></template>');v("\x3c!--$!--\x3e");v("\x3c!--/$--\x3e");v("<template");v('"');v(' data-dgst="');v(' data-msg="');v(' data-stck="');v("></template>");v('<div hidden id="');v('">');v("</div>");v('<svg aria-hidden="true" style="display:none" id="');v('">');v("</svg>");v('<math aria-hidden="true" style="display:none" id="');
|
|
23
|
-
v('<table hidden id="');v('">');v("</table>");v('<table hidden><tbody id="');v('">');v("</tbody></table>");v('<table hidden><tr id="');v('">');v("</tr></table>");v('<table hidden><colgroup id="');v('">');v("</colgroup></table>");v('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("');v('$RS("');v('","');v('")\x3c/script>');v('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("');
|
|
24
|
-
v('$RC("');v('","');v('")\x3c/script>');v('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("');v('$RX("');v('"');v(")\x3c/script>");v(",");var
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function
|
|
28
|
-
function
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
function
|
|
32
|
-
function
|
|
33
|
-
c.value),[z,a,b,{value:c.value,children:c.children,__pop:
|
|
34
|
-
function
|
|
35
|
-
function
|
|
36
|
-
function
|
|
37
|
-
y(c)){if(y(c)){f=c;"string"===typeof f&&(f=globalThis.__STRING_REFERENCE_INDEX[f]);f=f.filepath+"#"+f.name;g=a.writtenModules;var l=g.get(f);if(void 0!==l)return b[0]===z&&"1"===d?"@"+l.toString(16):"$"+l.toString(16);try{"string"===typeof c&&(c=globalThis.__STRING_REFERENCE_INDEX[c]);var
|
|
38
|
-
d=a.nextChunkId++,
|
|
39
|
-
typeof c)return a="$"===c[0]||"@"===c[0]?"$"+c:c,a;if("boolean"===typeof c||"number"===typeof c||"undefined"===typeof c)return c;if("function"===typeof c){if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to client component props. Remove "+(
|
|
40
|
-
(
|
|
41
|
-
d=a.nextChunkId++;b=x(
|
|
42
|
-
function
|
|
43
|
-
function
|
|
44
|
-
w)}}null!==a.destination&&
|
|
45
|
-
function
|
|
46
|
-
typeof b.flush&&b.flush();0===a.pendingChunks&&b.end()}function Da(a){setImmediate(function(){return
|
|
47
|
-
|
|
21
|
+
fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ha=["Webkit","ms","Moz","O"];Object.keys(H).forEach(function(a){ha.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);H[b]=H[a]})});var ia=Array.isArray;v("<script>");v("\x3c/script>");v('<script src="');v('<script type="module" src="');v('" integrity="');v('" async="">\x3c/script>');v("\x3c!-- --\x3e");v(' style="');v(":");v(";");v(" ");v('="');v('"');
|
|
22
|
+
v('=""');v(">");v("/>");v(' selected=""');v("\n");v("<!DOCTYPE html>");v("</");v(">");v('<template id="');v('"></template>');v("\x3c!--$--\x3e");v('\x3c!--$?--\x3e<template id="');v('"></template>');v("\x3c!--$!--\x3e");v("\x3c!--/$--\x3e");v("<template");v('"');v(' data-dgst="');v(' data-msg="');v(' data-stck="');v("></template>");v('<div hidden id="');v('">');v("</div>");v('<svg aria-hidden="true" style="display:none" id="');v('">');v("</svg>");v('<math aria-hidden="true" style="display:none" id="');
|
|
23
|
+
v('">');v("</math>");v('<table hidden id="');v('">');v("</table>");v('<table hidden><tbody id="');v('">');v("</tbody></table>");v('<table hidden><tr id="');v('">');v("</tr></table>");v('<table hidden><colgroup id="');v('">');v("</colgroup></table>");v('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("');v('$RS("');v('","');v('")\x3c/script>');v('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("');
|
|
24
|
+
v('$RC("');v('","');v('")\x3c/script>');v('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("');v('$RX("');v('"');v(")\x3c/script>");v(",");var I=null;
|
|
25
|
+
function J(a,b){if(a!==b){a.context._currentValue=a.parentValue;a=a.parent;var d=b.parent;if(null===a){if(null!==d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");}else{if(null===d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");J(a,d);b.context._currentValue=b.value}}}function ja(a){a.context._currentValue=a.parentValue;a=a.parent;null!==a&&ja(a)}
|
|
26
|
+
function ka(a){var b=a.parent;null!==b&&ka(b);a.context._currentValue=a.value}function la(a,b){a.context._currentValue=a.parentValue;a=a.parent;if(null===a)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===b.depth?J(a,b):la(a,b)}
|
|
27
|
+
function na(a,b){var d=b.parent;if(null===d)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===d.depth?J(a,d):na(a,d);b.context._currentValue=b.value}function K(a){var b=I;b!==a&&(null===b?ka(a):null===a?ja(b):b.depth===a.depth?J(b,a):b.depth>a.depth?la(b,a):na(b,a),I=a)}function oa(a,b){var d=a._currentValue;a._currentValue=b;var c=I;return I=a={parent:c,depth:null===c?0:c.depth+1,context:a,parentValue:d,value:b}}var L=null;
|
|
28
|
+
function pa(a){return a._currentValue}
|
|
29
|
+
var sa={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:M,useTransition:M,getCacheForType:function(a){if(!N)throw Error("Reading the cache is only supported while rendering.");var b=N.get(a);void 0===b&&(b=a(),N.set(a,b));return b},readContext:pa,useContext:pa,useReducer:M,useRef:M,useState:M,useInsertionEffect:M,useLayoutEffect:M,useImperativeHandle:M,useEffect:M,useId:qa,useMutableSource:M,useSyncExternalStore:M,useCacheRefresh:function(){return ra}};
|
|
30
|
+
function M(){throw Error("This Hook is not supported in Server Components.");}function ra(){if(!N)throw Error("Refreshing the cache is not supported in Server Components.");}var N=null;function qa(){if(null===L)throw Error("useId can only be used while React is rendering");var a=L.identifierCount++;return":"+L.identifierPrefix+"S"+a.toString(32)+":"}var ta=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=ta.ContextRegistry,P=ta.ReactCurrentDispatcher;function ua(a){console.error(a)}
|
|
31
|
+
function va(a,b,d,c,f){var g=new Set,l=[],m={status:0,fatalError:null,destination:null,bundlerConfig:b,cache:new Map,nextChunkId:0,pendingChunks:0,abortableTasks:g,pingedTasks:l,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,writtenProviders:new Map,identifierPrefix:f||"",identifierCount:1,onError:void 0===d?ua:d,toJSON:function(a,b){return wa(m,this,a,b)}};m.pendingChunks++;b=xa(c);a=ya(m,a,b,g);l.push(a);return m}var za={};
|
|
32
|
+
function Q(a,b,d,c){if(null!==d&&void 0!==d)throw Error("Refs cannot be used in server components, nor passed to client components.");if("function"===typeof a)return y(a)?[z,a,b,c]:a(c);if("string"===typeof a)return[z,a,b,c];if("symbol"===typeof a)return a===da?c.children:[z,a,b,c];if(null!=a&&"object"===typeof a){if(y(a))return[z,a,b,c];switch(a.$$typeof){case B:var f=a._init;a=f(a._payload);return Q(a,b,d,c);case ea:return b=a.render,b(c,void 0);case fa:return Q(a.type,b,d,c);case A:return oa(a._context,
|
|
33
|
+
c.value),[z,a,b,{value:c.value,children:c.children,__pop:za}]}}throw Error("Unsupported server component type: "+R(a));}function Aa(a,b){var d=a.pingedTasks;d.push(b);1===d.length&&setImmediate(function(){return Ba(a)})}function ya(a,b,d,c){var f={id:a.nextChunkId++,status:0,model:b,context:d,ping:function(){return Aa(a,f)}};c.add(f);return f}function Ca(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,d){return d})}
|
|
34
|
+
function T(a){var b=JSON.stringify(a);return'"'+a+'"'===b?a:b}function R(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(ia(a))return"[...]";a=Ca(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
|
|
35
|
+
function V(a,b){if(ia(a)){for(var d="[",c=0;c<a.length;c++){0<c&&(d+=", ");if(6<c){d+="...";break}var f=a[c];d=""+c===b&&"object"===typeof f&&null!==f?d+V(f):d+R(f)}return d+"]"}d="{";c=Object.keys(a);for(f=0;f<c.length;f++){0<f&&(d+=", ");if(6<f){d+="...";break}var g=c[f];d+=T(g)+": ";var l=a[g];d=g===b&&"object"===typeof l&&null!==l?d+V(l):d+R(l)}return d+"}"}
|
|
36
|
+
function wa(a,b,d,c){switch(c){case z:return"$"}for(;"object"===typeof c&&null!==c&&(c.$$typeof===z||c.$$typeof===B);)try{switch(c.$$typeof){case z:var f=c;c=Q(f.type,f.key,f.ref,f.props);break;case B:var g=c._init;c=g(c._payload)}}catch(t){if("object"===typeof t&&null!==t&&"function"===typeof t.then)return a.pendingChunks++,a=ya(a,c,I,a.abortableTasks),d=a.ping,t.then(d,d),"@"+a.id.toString(16);W(a,t);a.pendingChunks++;d=a.nextChunkId++;X(a,d,t);return"@"+d.toString(16)}if(null==c)return c;if("object"===
|
|
37
|
+
typeof c||y(c)){if(y(c)){f=c;"string"===typeof f&&(f=globalThis.__STRING_REFERENCE_INDEX[f]);f=f.filepath+"#"+f.name;g=a.writtenModules;var l=g.get(f);if(void 0!==l)return b[0]===z&&"1"===d?"@"+l.toString(16):"$"+l.toString(16);try{"string"===typeof c&&(c=globalThis.__STRING_REFERENCE_INDEX[c]);var m={id:c.filepath,name:c.name};a.pendingChunks++;var p=a.nextChunkId++,S=x(m);var U="M"+p.toString(16)+":"+S+"\n";a.completedModuleChunks.push(U);g.set(f,p);return b[0]===z&&"1"===d?"@"+p.toString(16):"$"+
|
|
38
|
+
p.toString(16)}catch(t){return a.pendingChunks++,d=a.nextChunkId++,X(a,d,t),"$"+d.toString(16)}}else{if(c.$$typeof===A)return b=c._context._globalName,c=a.writtenProviders,d=c.get(d),void 0===d&&(a.pendingChunks++,d=a.nextChunkId++,c.set(b,d),b="P"+d.toString(16)+":"+b+"\n",a.completedJSONChunks.push(b)),"$"+d.toString(16);if(c===za){a=I;if(null===a)throw Error("Tried to pop a Context at the root of the app. This is a bug in React.");d=a.parentValue;a.context._currentValue=d===C?a.context._defaultValue:
|
|
39
|
+
d;I=a.parent;return}}return c}if("string"===typeof c)return a="$"===c[0]||"@"===c[0]?"$"+c:c,a;if("boolean"===typeof c||"number"===typeof c||"undefined"===typeof c)return c;if("function"===typeof c){if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to client component props. Remove "+(T(d)+" from these props if possible: "+V(b)+"\nIf you need interactivity, consider converting part of this to a client component."));throw Error("Functions cannot be passed directly to client components because they're not serializable. Remove "+
|
|
40
|
+
(T(d)+" ("+(c.displayName||c.name||"function")+") from this object, or avoid the entire object: "+V(b)));}if("symbol"===typeof c){m=a.writtenSymbols;p=m.get(c);if(void 0!==p)return"$"+p.toString(16);p=c.description;if(Symbol.for(p)!==c)throw Error("Only global symbols received from Symbol.for(...) can be passed to client components. The symbol Symbol.for("+(c.description+") cannot be found among global symbols. Remove ")+(T(d)+" from this object, or avoid the entire object: "+V(b)));a.pendingChunks++;
|
|
41
|
+
d=a.nextChunkId++;b=x(p);b="S"+d.toString(16)+":"+b+"\n";a.completedModuleChunks.push(b);m.set(c,d);return"$"+d.toString(16)}if("bigint"===typeof c)throw Error("BigInt ("+c+") is not yet supported in client component props. Remove "+(T(d)+" from this object or use a plain number instead: "+V(b)));throw Error("Type "+typeof c+" is not supported in client component props. Remove "+(T(d)+" from this object, or avoid the entire object: "+V(b)));}function W(a,b){a=a.onError;a(b)}
|
|
42
|
+
function Y(a,b){null!==a.destination?(a.status=2,a.destination.destroy(b)):(a.status=1,a.fatalError=b)}function X(a,b,d){var c="";try{if(d instanceof Error){var f=String(d.message);c=String(d.stack)}else f="Error: "+d}catch(g){f="An error occurred but serializing the error message failed."}d={message:f,stack:c};b="E"+b.toString(16)+":"+x(d)+"\n";a.completedErrorChunks.push(b)}
|
|
43
|
+
function Ba(a){var b=P.current,d=N;P.current=sa;N=a.cache;L=a;try{var c=a.pingedTasks;a.pingedTasks=[];for(var f=0;f<c.length;f++){var g=c[f];var l=a;if(0===g.status){K(g.context);try{for(var m=g.model;"object"===typeof m&&null!==m&&m.$$typeof===z;){var p=m;g.model=m;m=Q(p.type,p.key,p.ref,p.props)}var S=g.id,U=x(m,l.toJSON);var t="J"+S.toString(16)+":"+U+"\n";l.completedJSONChunks.push(t);l.abortableTasks.delete(g);g.status=1}catch(w){if("object"===typeof w&&null!==w&&"function"===typeof w.then){var ma=
|
|
44
|
+
g.ping;w.then(ma,ma)}else l.abortableTasks.delete(g),g.status=4,W(l,w),X(l,g.id,w)}}}null!==a.destination&&Z(a,a.destination)}catch(w){W(a,w),Y(a,w)}finally{P.current=b,N=d,L=null}}
|
|
45
|
+
function Z(a,b){h=new Uint8Array(2048);k=0;n=!0;try{for(var d=a.completedModuleChunks,c=0;c<d.length;c++)if(a.pendingChunks--,!r(b,d[c])){a.destination=null;c++;break}d.splice(0,c);var f=a.completedJSONChunks;for(c=0;c<f.length;c++)if(a.pendingChunks--,!r(b,f[c])){a.destination=null;c++;break}f.splice(0,c);var g=a.completedErrorChunks;for(c=0;c<g.length;c++)if(a.pendingChunks--,!r(b,g[c])){a.destination=null;c++;break}g.splice(0,c)}finally{h&&0<k&&b.write(h.subarray(0,k)),h=null,k=0,n=!0}"function"===
|
|
46
|
+
typeof b.flush&&b.flush();0===a.pendingChunks&&b.end()}function Da(a){setImmediate(function(){return Ba(a)})}function Ea(a,b){if(1===a.status)a.status=2,b.destroy(a.fatalError);else if(2!==a.status&&null===a.destination){a.destination=b;try{Z(a,b)}catch(d){W(a,d),Y(a,d)}}}
|
|
47
|
+
function Fa(a,b){try{var d=a.abortableTasks;if(0<d.size){var c=void 0===b?Error("The render was aborted by the server without a reason."):b;W(a,c);a.pendingChunks++;var f=a.nextChunkId++;X(a,f,c);d.forEach(function(b){b.status=3;var c="$"+f.toString(16);b=b.id;c=x(c);c="J"+b.toString(16)+":"+c+"\n";a.completedJSONChunks.push(c)});d.clear()}null!==a.destination&&Z(a,a.destination)}catch(g){W(a,g),Y(a,g)}}
|
|
48
|
+
function xa(a){if(a){var b=I;K(null);for(var d=0;d<a.length;d++){var c=a[d],f=c[0];c=c[1];O[f]||(O[f]=e.createServerContext(f,C));oa(O[f],c)}a=I;K(b);return a}return null}function Ga(a,b){return function(){return Ea(b,a)}}
|
|
49
|
+
exports.renderToPipeableStream=function(a,b){var d=va(ba({},a,{$$typeof:Symbol.for("react.element"),props:{children:a},type:function(){e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current.isRsc=!0;return a}}),{},b?b.onError:void 0,b?b.context:void 0,b?b.identifierPrefix:void 0),c=!1;Da(d);return{pipe:function(a){if(c)throw Error("React currently only supports piping to one writable stream.");c=!0;Ea(d,a);a.on("drain",Ga(a,d));return a},abort:function(a){Fa(d,a)}}};
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import { init, parse } from 'es-module-lexer';
|
|
12
12
|
import MagicString from 'magic-string';
|
|
13
|
-
import { normalizePath, transformWithEsbuild, createServer } from 'vite';
|
|
14
13
|
import { promises } from 'fs';
|
|
15
14
|
import path from 'path';
|
|
15
|
+
import { version, normalizePath as normalizePath$1, transformWithEsbuild as transformWithEsbuild$1, createServer as createServer$1 } from 'vite';
|
|
16
16
|
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) {
|
|
18
18
|
if (!o) return;
|
|
@@ -90,6 +90,10 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
90
90
|
|
|
91
91
|
var assign = Object.assign;
|
|
92
92
|
|
|
93
|
+
var normalizePath = normalizePath$1,
|
|
94
|
+
transformWithEsbuild = transformWithEsbuild$1,
|
|
95
|
+
createServer = createServer$1;
|
|
96
|
+
var isVite3 = version && version.startsWith('3.');
|
|
93
97
|
var rscViteFileRE = /\/react-server-dom-vite.js/;
|
|
94
98
|
var noProxyRE = /[&?]no-proxy($|&)/;
|
|
95
99
|
|
|
@@ -124,10 +128,10 @@ function ReactFlightVitePlugin() {
|
|
|
124
128
|
enforce: 'pre',
|
|
125
129
|
buildStart: function () {
|
|
126
130
|
// Let other plugins differentiate between pure SSR and RSC builds
|
|
127
|
-
if (config?.build?.ssr) process.env.
|
|
131
|
+
if (config?.build?.ssr) process.env.VITE_RSC_BUILD = 'true';
|
|
128
132
|
},
|
|
129
133
|
buildEnd: function () {
|
|
130
|
-
if (config?.build?.ssr) delete process.env.
|
|
134
|
+
if (config?.build?.ssr) delete process.env.VITE_RSC_BUILD;
|
|
131
135
|
},
|
|
132
136
|
configureServer: function (_server) {
|
|
133
137
|
server = _server;
|
|
@@ -298,7 +302,7 @@ function ReactFlightVitePlugin() {
|
|
|
298
302
|
throw new Error('[react-server-dom-vite] Parameter serverBuildEntries is required for client build');
|
|
299
303
|
}
|
|
300
304
|
|
|
301
|
-
return findClientBoundariesForClientBuild(serverBuildEntries, optimizeBoundaries !== false).then(injectGlobs);
|
|
305
|
+
return findClientBoundariesForClientBuild(serverBuildEntries, optimizeBoundaries !== false, config.root).then(injectGlobs);
|
|
302
306
|
}
|
|
303
307
|
},
|
|
304
308
|
handleHotUpdate: function (_ref2) {
|
|
@@ -401,13 +405,16 @@ function findClientBoundaries(moduleGraph) {
|
|
|
401
405
|
return clientBoundaries;
|
|
402
406
|
}
|
|
403
407
|
|
|
404
|
-
async function findClientBoundariesForClientBuild(serverEntries, optimizeBoundaries) {
|
|
408
|
+
async function findClientBoundariesForClientBuild(serverEntries, optimizeBoundaries, root) {
|
|
405
409
|
// Viteception
|
|
406
410
|
var server = await createServer({
|
|
411
|
+
root: root,
|
|
407
412
|
clearScreen: false,
|
|
408
413
|
server: {
|
|
409
|
-
middlewareMode: 'ssr'
|
|
410
|
-
|
|
414
|
+
middlewareMode: isVite3 ? true : 'ssr',
|
|
415
|
+
hmr: false
|
|
416
|
+
},
|
|
417
|
+
appType: 'custom'
|
|
411
418
|
});
|
|
412
419
|
|
|
413
420
|
try {
|
|
@@ -430,7 +437,8 @@ var hashImportsPlugin = {
|
|
|
430
437
|
if (rscViteFileRE.test(id)) {
|
|
431
438
|
var s = new MagicString(code);
|
|
432
439
|
s.replace(/\/\*\s*HASH_BEGIN\s*\*\/\s*([^]+?)\/\*\s*HASH_END\s*\*\//gm, function (_, imports) {
|
|
433
|
-
return imports.trim().replace(/"([^"]+?)":/gm, function (
|
|
440
|
+
return imports.trim().replace(/"([^"]+?)":/gm, function (all, relativePath) {
|
|
441
|
+
if (relativePath === '__VITE_PRELOAD__') return all;
|
|
434
442
|
var absolutePath = path.resolve(path.dirname(id.split('?')[0]), relativePath);
|
|
435
443
|
return "\"" + getComponentId(normalizePath(absolutePath)) + "\":";
|
|
436
444
|
});
|
|
@@ -524,17 +532,20 @@ function isDirectImportInServer(originalMod, currentMod, accModInfo) {
|
|
|
524
532
|
});
|
|
525
533
|
}
|
|
526
534
|
|
|
527
|
-
|
|
528
|
-
|
|
535
|
+
var RESOLVE_EXTENSIONS = ['', '.js', '.ts', '.jsx', '.tsx', '/index', '/index.js', '/index.ts', '/index.jsx', '/index.tsx']; // Resolve relative paths and aliases. Examples:
|
|
536
|
+
// - import {XYZ} from '~/components' => import {XYZ} from '<absolute>/src/components/index.ts'
|
|
537
|
+
// - import {XYZ} from '/src/component.client' => import {XYZ} from '<absolute>/src/component.client.jsx'`
|
|
529
538
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
539
|
+
function resolveModPath(modPath, dirname) {
|
|
540
|
+
var extensions = /\.[jt]sx?$/.test(modPath) ? [''] : RESOLVE_EXTENSIONS;
|
|
541
|
+
|
|
542
|
+
for (var i = 0; i < extensions.length; i++) {
|
|
543
|
+
var extension = extensions[i];
|
|
544
|
+
|
|
545
|
+
try {
|
|
546
|
+
var absolutePath = modPath.startsWith('.') ? normalizePath(path.resolve(dirname, modPath)) : modPath;
|
|
547
|
+
return normalizePath(require.resolve(absolutePath + extension));
|
|
548
|
+
} catch (error) {// Do not throw, this is likely a virtual module or another exception
|
|
538
549
|
}
|
|
539
550
|
}
|
|
540
551
|
}
|