@cedarjs/vite 5.0.6 → 5.0.7-next.186
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/api/vite-plugin-cedar-vitest-api-preset.d.ts.map +1 -1
- package/dist/api/vite-plugin-cedar-vitest-api-preset.js +4 -0
- package/dist/apiDevMiddleware.d.ts.map +1 -1
- package/dist/apiDevMiddleware.js +117 -15
- package/dist/buildApp.d.ts.map +1 -1
- package/dist/buildApp.js +79 -18
- package/dist/buildRouteHooks.d.ts.map +1 -1
- package/dist/buildRouteHooks.js +36 -4
- package/dist/bundled/react-server-dom-webpack.server.js +192 -99
- package/dist/cedar-unified-dev.d.ts +18 -0
- package/dist/cedar-unified-dev.d.ts.map +1 -1
- package/dist/cedar-unified-dev.js +39 -5
- package/dist/devFeServer.js +3 -8
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -19
- package/dist/lib/generateDiffSourceMap.d.ts +18 -0
- package/dist/lib/generateDiffSourceMap.d.ts.map +1 -0
- package/dist/lib/generateDiffSourceMap.js +151 -0
- package/dist/lib/getMergedConfig.d.ts.map +1 -1
- package/dist/lib/getMergedConfig.js +4 -0
- package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts +13 -0
- package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-api-import-guard.js +17 -0
- package/dist/plugins/vite-plugin-cedar-auto-import.d.ts +1 -1
- package/dist/plugins/vite-plugin-cedar-auto-import.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-auto-import.js +8 -1
- package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-cell.js +2 -1
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts +3 -0
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.js +43 -0
- package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts +12 -0
- package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-directory-named-import.js +35 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts +29 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.js +76 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts +42 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.js +93 -0
- package/dist/plugins/vite-plugin-cedar-import-dir.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-import-dir.js +44 -31
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts +28 -0
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.js +67 -0
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts +28 -0
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.js +247 -0
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts +39 -0
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.js +200 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +92 -90
- package/dist/plugins/vite-plugin-cedarjs-job-path-injector.d.ts +29 -0
- package/dist/plugins/vite-plugin-cedarjs-job-path-injector.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedarjs-job-path-injector.js +63 -81
- package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +14 -0
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.d.ts → vite-plugin-handler-als-wrapping.d.ts} +12 -12
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -0
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js} +16 -16
- package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts +3 -0
- package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-swap-apollo-provider.js +2 -2
- package/dist/rsc/rscBuildForSsr.d.ts.map +1 -1
- package/dist/rsc/rscBuildForSsr.js +3 -5
- package/dist/streaming/buildForStreamingServer.d.ts.map +1 -1
- package/dist/streaming/buildForStreamingServer.js +3 -5
- package/package.json +41 -52
- package/dist/cjs/ClientRouter.d.ts +0 -1
- package/dist/cjs/api/vite-plugin-cedar-vitest-api-preset.js +0 -37
- package/dist/cjs/apiDevMiddleware.js +0 -371
- package/dist/cjs/build/build.d.ts +0 -1
- package/dist/cjs/build/build.js +0 -58
- package/dist/cjs/buildApp.js +0 -306
- package/dist/cjs/buildFeServer.d.ts +0 -1
- package/dist/cjs/buildFeServer.js +0 -63
- package/dist/cjs/buildRouteHooks.js +0 -80
- package/dist/cjs/buildRouteManifest.js +0 -92
- package/dist/cjs/buildRscClientAndServer.js +0 -54
- package/dist/cjs/cedar-unified-dev.js +0 -310
- package/dist/cjs/client.d.ts +0 -1
- package/dist/cjs/clientSsr.d.ts +0 -1
- package/dist/cjs/devFeServer.js +0 -157
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -141
- package/dist/cjs/lib/StatusError.js +0 -37
- package/dist/cjs/lib/entries.js +0 -52
- package/dist/cjs/lib/getMergedConfig.js +0 -185
- package/dist/cjs/lib/onWarn.js +0 -36
- package/dist/cjs/lib/registerFwGlobalsAndShims.js +0 -102
- package/dist/cjs/lib/workspacePackageAliases.js +0 -107
- package/dist/cjs/middleware/index.js +0 -22
- package/dist/cjs/middleware/invokeMiddleware.js +0 -52
- package/dist/cjs/middleware/register.js +0 -105
- package/dist/cjs/middleware/types.js +0 -16
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/plugins/vite-plugin-cedar-auto-import.js +0 -107
- package/dist/cjs/plugins/vite-plugin-cedar-cell.js +0 -183
- package/dist/cjs/plugins/vite-plugin-cedar-cjs-compat.js +0 -341
- package/dist/cjs/plugins/vite-plugin-cedar-context-wrapping.js +0 -95
- package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +0 -107
- package/dist/cjs/plugins/vite-plugin-cedar-html-env.js +0 -67
- package/dist/cjs/plugins/vite-plugin-cedar-import-dir.js +0 -118
- package/dist/cjs/plugins/vite-plugin-cedar-node-polyfills.js +0 -43
- package/dist/cjs/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js +0 -61
- package/dist/cjs/plugins/vite-plugin-cedar-remove-from-bundle.js +0 -76
- package/dist/cjs/plugins/vite-plugin-cedar-routes-auto-loader.js +0 -126
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +0 -346
- package/dist/cjs/plugins/vite-plugin-cedar-wait-for-api-server.js +0 -134
- package/dist/cjs/plugins/vite-plugin-cedarjs-job-path-injector.js +0 -134
- package/dist/cjs/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +0 -106
- package/dist/cjs/plugins/vite-plugin-jsx-loader.js +0 -42
- package/dist/cjs/plugins/vite-plugin-merged-config.js +0 -39
- package/dist/cjs/plugins/vite-plugin-rsc-analyze.js +0 -104
- package/dist/cjs/plugins/vite-plugin-rsc-reload.js +0 -75
- package/dist/cjs/plugins/vite-plugin-rsc-routes-auto-loader.js +0 -159
- package/dist/cjs/plugins/vite-plugin-rsc-routes-imports.js +0 -125
- package/dist/cjs/plugins/vite-plugin-rsc-ssr-router-import.js +0 -75
- package/dist/cjs/plugins/vite-plugin-rsc-transform-client.js +0 -228
- package/dist/cjs/plugins/vite-plugin-rsc-transform-server.js +0 -398
- package/dist/cjs/plugins/vite-plugin-swap-apollo-provider.js +0 -46
- package/dist/cjs/rsc/rscBuildAnalyze.js +0 -126
- package/dist/cjs/rsc/rscBuildClient.js +0 -91
- package/dist/cjs/rsc/rscBuildCopyCssAssets.js +0 -56
- package/dist/cjs/rsc/rscBuildEntriesFile.js +0 -115
- package/dist/cjs/rsc/rscBuildForServer.js +0 -168
- package/dist/cjs/rsc/rscBuildForSsr.js +0 -173
- package/dist/cjs/rsc/rscBuildRwEnvVars.js +0 -56
- package/dist/cjs/rsc/rscRenderer.js +0 -165
- package/dist/cjs/rsc/rscRequestHandler.js +0 -162
- package/dist/cjs/rsc/rscStudioHandlers.js +0 -156
- package/dist/cjs/runFeServer.js +0 -165
- package/dist/cjs/streaming/buildForStreamingServer.js +0 -65
- package/dist/cjs/streaming/collectCss.js +0 -52
- package/dist/cjs/streaming/createReactStreamingHandler.js +0 -173
- package/dist/cjs/streaming/streamHelpers.js +0 -230
- package/dist/cjs/streaming/transforms/bufferedTransform.js +0 -61
- package/dist/cjs/streaming/transforms/cancelTimeoutTransform.js +0 -34
- package/dist/cjs/streaming/transforms/encode-decode.js +0 -36
- package/dist/cjs/streaming/transforms/serverInjectionTransform.js +0 -84
- package/dist/cjs/streaming/triggerRouteHooks.js +0 -96
- package/dist/cjs/types.js +0 -16
- package/dist/cjs/utils.js +0 -92
- package/dist/package.json +0 -1
- package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts +0 -3
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-node-polyfills.js +0 -19
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var serverInjectionTransform_exports = {};
|
|
20
|
-
__export(serverInjectionTransform_exports, {
|
|
21
|
-
createServerInjectionTransform: () => createServerInjectionTransform
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(serverInjectionTransform_exports);
|
|
24
|
-
var import_encode_decode = require("./encode-decode.js");
|
|
25
|
-
function createServerInjectionTransform({
|
|
26
|
-
injectionState,
|
|
27
|
-
createElement,
|
|
28
|
-
ServerInjectedHtml,
|
|
29
|
-
renderToString,
|
|
30
|
-
onlyOnFlush = false
|
|
31
|
-
}) {
|
|
32
|
-
const transformStream = new TransformStream({
|
|
33
|
-
transform(chunk, controller) {
|
|
34
|
-
if (onlyOnFlush) {
|
|
35
|
-
controller.enqueue(chunk);
|
|
36
|
-
} else {
|
|
37
|
-
const mergedBytes = insertHtml(chunk);
|
|
38
|
-
controller.enqueue(mergedBytes);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
flush(controller) {
|
|
42
|
-
const mergedBytes = insertHtml();
|
|
43
|
-
controller.enqueue(mergedBytes);
|
|
44
|
-
const moveTagsScript = (0, import_encode_decode.encodeText)(`<script>document.querySelectorAll('body [data-rwjs-head]').forEach((el) => {
|
|
45
|
-
document.querySelectorAll('head ' + el.tagName).forEach((e) => {
|
|
46
|
-
if (
|
|
47
|
-
el.tagName === 'TITLE' ||
|
|
48
|
-
(el.tagName === 'META' &&
|
|
49
|
-
el.getAttribute('name') === e.getAttribute('name') &&
|
|
50
|
-
el.getAttribute('property') === e.getAttribute('property'))
|
|
51
|
-
) {
|
|
52
|
-
e.remove();
|
|
53
|
-
}
|
|
54
|
-
document.head.appendChild(el);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
</script>`);
|
|
58
|
-
controller.enqueue(moveTagsScript);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return transformStream;
|
|
62
|
-
function insertHtml(chunk) {
|
|
63
|
-
const serverHtmlOutput = renderToString(
|
|
64
|
-
createElement(ServerInjectedHtml, {
|
|
65
|
-
injectionState
|
|
66
|
-
})
|
|
67
|
-
);
|
|
68
|
-
const injectedBytes = (0, import_encode_decode.encodeText)(serverHtmlOutput);
|
|
69
|
-
if (chunk !== void 0) {
|
|
70
|
-
const mergedBytes = new Uint8Array(chunk.length + injectedBytes.length);
|
|
71
|
-
mergedBytes.set(chunk);
|
|
72
|
-
mergedBytes.set(injectedBytes, chunk.length);
|
|
73
|
-
return mergedBytes;
|
|
74
|
-
} else {
|
|
75
|
-
const injectedHtmlOutput = new Uint8Array(injectedBytes.length);
|
|
76
|
-
injectedHtmlOutput.set(injectedBytes);
|
|
77
|
-
return injectedHtmlOutput;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
-
0 && (module.exports = {
|
|
83
|
-
createServerInjectionTransform
|
|
84
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var triggerRouteHooks_exports = {};
|
|
20
|
-
__export(triggerRouteHooks_exports, {
|
|
21
|
-
loadAndRunRouteHooks: () => loadAndRunRouteHooks,
|
|
22
|
-
triggerRouteHooks: () => triggerRouteHooks
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(triggerRouteHooks_exports);
|
|
25
|
-
var import_util = require("@cedarjs/router/util");
|
|
26
|
-
const triggerRouteHooks = async ({
|
|
27
|
-
routeHooks,
|
|
28
|
-
req,
|
|
29
|
-
parsedParams = {},
|
|
30
|
-
previousOutput
|
|
31
|
-
}) => {
|
|
32
|
-
const event = {
|
|
33
|
-
params: parsedParams,
|
|
34
|
-
headers: req.headers || {},
|
|
35
|
-
query: (0, import_util.parseSearch)(req.url),
|
|
36
|
-
// cookies: req.cookies || {}, // TODO (STREAMING) we probably need some sort of cookie parser
|
|
37
|
-
// TODO (STREAMING) called app routeHook, but its just the previous output
|
|
38
|
-
appRouteHook: previousOutput
|
|
39
|
-
};
|
|
40
|
-
let meta = previousOutput?.meta || [];
|
|
41
|
-
try {
|
|
42
|
-
const metaRouteHookOutput = await routeHooks?.meta?.(event) || [];
|
|
43
|
-
const currentMeta = Array.isArray(metaRouteHookOutput) ? metaRouteHookOutput : [metaRouteHookOutput];
|
|
44
|
-
meta = [...meta, ...currentMeta];
|
|
45
|
-
} catch (e) {
|
|
46
|
-
throw new Error(`Error in meta hook: ${e.message}`);
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
meta
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
const defaultRouteHookOutput = {
|
|
53
|
-
meta: []
|
|
54
|
-
};
|
|
55
|
-
const loadAndRunRouteHooks = async ({
|
|
56
|
-
paths = [],
|
|
57
|
-
reqMeta,
|
|
58
|
-
viteDevServer,
|
|
59
|
-
previousOutput = defaultRouteHookOutput
|
|
60
|
-
}) => {
|
|
61
|
-
const loadModule = async (path) => {
|
|
62
|
-
return viteDevServer ? viteDevServer.ssrLoadModule(path) : import(path);
|
|
63
|
-
};
|
|
64
|
-
let currentRouteHooks;
|
|
65
|
-
let rhOutput = defaultRouteHookOutput;
|
|
66
|
-
const routeHookPath = paths.shift();
|
|
67
|
-
try {
|
|
68
|
-
if (routeHookPath) {
|
|
69
|
-
currentRouteHooks = await loadModule(routeHookPath);
|
|
70
|
-
rhOutput = await triggerRouteHooks({
|
|
71
|
-
routeHooks: currentRouteHooks,
|
|
72
|
-
req: reqMeta.req,
|
|
73
|
-
parsedParams: reqMeta.parsedParams,
|
|
74
|
-
previousOutput
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
if (paths.length > 0) {
|
|
78
|
-
return loadAndRunRouteHooks({
|
|
79
|
-
paths,
|
|
80
|
-
reqMeta,
|
|
81
|
-
previousOutput: rhOutput,
|
|
82
|
-
viteDevServer
|
|
83
|
-
});
|
|
84
|
-
} else {
|
|
85
|
-
return rhOutput;
|
|
86
|
-
}
|
|
87
|
-
} catch (e) {
|
|
88
|
-
console.error(`Error loading route hooks in ${routeHookPath}}`);
|
|
89
|
-
throw e;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
-
0 && (module.exports = {
|
|
94
|
-
loadAndRunRouteHooks,
|
|
95
|
-
triggerRouteHooks
|
|
96
|
-
});
|
package/dist/cjs/types.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
package/dist/cjs/utils.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var utils_exports = {};
|
|
20
|
-
__export(utils_exports, {
|
|
21
|
-
convertExpressHeaders: () => convertExpressHeaders,
|
|
22
|
-
ensureProcessDirWeb: () => ensureProcessDirWeb,
|
|
23
|
-
getFullUrl: () => getFullUrl,
|
|
24
|
-
makeFilePath: () => makeFilePath,
|
|
25
|
-
ssrLoadEntryServer: () => ssrLoadEntryServer,
|
|
26
|
-
stripQueryStringAndHashFromPath: () => stripQueryStringAndHashFromPath
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(utils_exports);
|
|
29
|
-
var import_node_url = require("node:url");
|
|
30
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
31
|
-
var import_packageManager = require("@cedarjs/project-config/packageManager");
|
|
32
|
-
function stripQueryStringAndHashFromPath(url) {
|
|
33
|
-
return url.split("?")[0].split("#")[0];
|
|
34
|
-
}
|
|
35
|
-
function ensureProcessDirWeb(webDir = (0, import_project_config.getPaths)().web.base) {
|
|
36
|
-
if (process.cwd() !== webDir) {
|
|
37
|
-
console.error("\u26A0\uFE0F Warning: CWD is ", process.cwd());
|
|
38
|
-
console.warn("~".repeat(50));
|
|
39
|
-
console.warn(
|
|
40
|
-
`The cwd must be web/. Please use \`${(0, import_packageManager.prettyPrintCedarCommand)(["<command>"])}\` or run the command from the web/ directory.`
|
|
41
|
-
);
|
|
42
|
-
console.log(`Changing cwd to ${webDir}....`);
|
|
43
|
-
console.log();
|
|
44
|
-
process.chdir(webDir);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function makeFilePath(path) {
|
|
48
|
-
return (0, import_node_url.pathToFileURL)(path).href;
|
|
49
|
-
}
|
|
50
|
-
async function ssrLoadEntryServer(viteDevServer) {
|
|
51
|
-
const rwPaths = (0, import_project_config.getPaths)();
|
|
52
|
-
if (!rwPaths.web.entryServer) {
|
|
53
|
-
throw new Error("entryServer not defined");
|
|
54
|
-
}
|
|
55
|
-
return viteDevServer.ssrLoadModule(
|
|
56
|
-
rwPaths.web.entryServer
|
|
57
|
-
// Have to type cast here because ssrLoadModule just returns a generic
|
|
58
|
-
// Record<string, any> type
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
function convertExpressHeaders(expressDistinctHeaders) {
|
|
62
|
-
const headers = new Headers();
|
|
63
|
-
for (const name in expressDistinctHeaders) {
|
|
64
|
-
const values = expressDistinctHeaders[name];
|
|
65
|
-
if (Array.isArray(values)) {
|
|
66
|
-
for (const value of values) {
|
|
67
|
-
headers.append(name, value);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return headers;
|
|
72
|
-
}
|
|
73
|
-
const getFullUrl = (req, rscEnabled) => {
|
|
74
|
-
const baseUrl = req.protocol + "://" + req.headers.host;
|
|
75
|
-
const url = new URL(req.originalUrl || "", baseUrl);
|
|
76
|
-
const pathname = url.searchParams.get("__cedarjs__pathname");
|
|
77
|
-
const search = url.searchParams.get("__cedarjs__search");
|
|
78
|
-
let pathnamePlusSearch = req.originalUrl;
|
|
79
|
-
if (rscEnabled && pathname !== null && search !== null) {
|
|
80
|
-
pathnamePlusSearch = pathname + "?" + search;
|
|
81
|
-
}
|
|
82
|
-
return baseUrl + pathnamePlusSearch;
|
|
83
|
-
};
|
|
84
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
-
0 && (module.exports = {
|
|
86
|
-
convertExpressHeaders,
|
|
87
|
-
ensureProcessDirWeb,
|
|
88
|
-
getFullUrl,
|
|
89
|
-
makeFilePath,
|
|
90
|
-
ssrLoadEntryServer,
|
|
91
|
-
stripQueryStringAndHashFromPath
|
|
92
|
-
});
|
package/dist/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-context-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-context-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,YAAoB,GACrB,GAAE;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,MAAM,CAuBd;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CAsDf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-node-polyfills.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-node-polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAiBvD"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
2
|
-
import { getConfig } from "@cedarjs/project-config";
|
|
3
|
-
function cedarNodePolyfills() {
|
|
4
|
-
if (getConfig().experimental?.rsc?.enabled) {
|
|
5
|
-
return void 0;
|
|
6
|
-
}
|
|
7
|
-
return {
|
|
8
|
-
...nodePolyfills({
|
|
9
|
-
include: ["buffer"],
|
|
10
|
-
globals: {
|
|
11
|
-
Buffer: true
|
|
12
|
-
}
|
|
13
|
-
}),
|
|
14
|
-
apply: "serve"
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
cedarNodePolyfills
|
|
19
|
-
};
|