@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
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
+
import type { BabelOptions } from '@vitejs/plugin-react';
|
|
1
2
|
import type { PluginOption } from 'vite';
|
|
3
|
+
export { cedarApiImportGuardPlugin } from './plugins/vite-plugin-cedar-api-import-guard.js';
|
|
2
4
|
export { cedarAutoImportsPlugin } from './plugins/vite-plugin-cedar-auto-import.js';
|
|
3
5
|
export { cedarCjsCompatPlugin } from './plugins/vite-plugin-cedar-cjs-compat.js';
|
|
4
6
|
export { cedarCellTransform } from './plugins/vite-plugin-cedar-cell.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
+
export { cedarGqlormInjectPlugin } from './plugins/vite-plugin-cedar-gqlorm-inject.js';
|
|
8
|
+
export { cedarGraphqlOptionsExtractPlugin } from './plugins/vite-plugin-cedar-graphql-options-extract.js';
|
|
9
|
+
export { cedarOtelWrappingPlugin } from './plugins/vite-plugin-cedar-otel-wrapping.js';
|
|
10
|
+
export { applyHandlerAlsWrapping, handlerAlsWrappingPlugin, } from './plugins/vite-plugin-handler-als-wrapping.js';
|
|
7
11
|
export { cedarEntryInjectionPlugin } from './plugins/vite-plugin-cedar-entry-injection.js';
|
|
8
12
|
export { cedarHtmlEnvPlugin } from './plugins/vite-plugin-cedar-html-env.js';
|
|
13
|
+
export { cedarDirectoryNamedImportPlugin } from './plugins/vite-plugin-cedar-directory-named-import.js';
|
|
9
14
|
export { cedarImportDirPlugin } from './plugins/vite-plugin-cedar-import-dir.js';
|
|
10
|
-
export {
|
|
15
|
+
export { cedarDataUriShim } from './plugins/vite-plugin-cedar-data-uri-shim.js';
|
|
11
16
|
export { cedarRemoveDevFatalErrorPage } from './plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js';
|
|
12
17
|
export { cedarRoutesAutoLoaderPlugin } from './plugins/vite-plugin-cedar-routes-auto-loader.js';
|
|
13
18
|
export { cedarRemoveFromBundle } from './plugins/vite-plugin-cedar-remove-from-bundle.js';
|
|
14
19
|
export { cedarjsResolveCedarStyleImportsPlugin } from './plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js';
|
|
15
20
|
export { cedarjsJobPathInjectorPlugin } from './plugins/vite-plugin-cedarjs-job-path-injector.js';
|
|
21
|
+
export { cedarMockCellDataPlugin } from './plugins/vite-plugin-cedar-mock-cell-data.js';
|
|
16
22
|
export { cedarTransformJsAsJsx } from './plugins/vite-plugin-jsx-loader.js';
|
|
17
23
|
export { cedarMergedConfig } from './plugins/vite-plugin-merged-config.js';
|
|
18
24
|
export { cedarSwapApolloProvider } from './plugins/vite-plugin-swap-apollo-provider.js';
|
|
@@ -20,11 +26,12 @@ export { cedarUniversalDeployPlugin } from './plugins/vite-plugin-cedar-universa
|
|
|
20
26
|
export { cedarWaitForApiServer } from './plugins/vite-plugin-cedar-wait-for-api-server.js';
|
|
21
27
|
type PluginOptions = {
|
|
22
28
|
mode?: string | undefined;
|
|
29
|
+
babel?: BabelOptions | undefined;
|
|
23
30
|
};
|
|
24
31
|
/**
|
|
25
32
|
* Pre-configured vite plugin, with required config for CedarJS apps.
|
|
26
33
|
*/
|
|
27
|
-
export declare function cedar({ mode }?: PluginOptions): PluginOption[];
|
|
34
|
+
export declare function cedar({ mode, babel }?: PluginOptions): PluginOption[];
|
|
28
35
|
/** @deprecated Please use the named `cedar` export instead */
|
|
29
36
|
export default cedar;
|
|
30
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAqCxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAA;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAA;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAA;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,8DAA8D,CAAA;AACpH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAA;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAA;AAE1F,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAE,aAAkB,GAAG,YAAY,EAAE,CAgDzE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import react from "@vitejs/plugin-react";
|
|
2
|
-
import {
|
|
2
|
+
import { gqlPlugin as gqlTagPlugin } from "vite-plugin-graphql-tag";
|
|
3
|
+
import tsPathsMod from "vite-tsconfig-paths";
|
|
4
|
+
const tsconfigPaths = (
|
|
5
|
+
// @ts-expect-error – .default only exists at runtime in CJS double-wrap
|
|
6
|
+
// interop
|
|
7
|
+
tsPathsMod.default?.default || tsPathsMod.default || tsPathsMod
|
|
8
|
+
);
|
|
3
9
|
import { getConfig } from "@cedarjs/project-config";
|
|
4
10
|
import {
|
|
5
11
|
autoImportsPlugin,
|
|
6
12
|
cedarJsRouterImportTransformPlugin,
|
|
13
|
+
cedarVitestWebConfigPlugin,
|
|
7
14
|
createAuthImportTransformPlugin
|
|
8
15
|
} from "@cedarjs/testing/web/vitest";
|
|
16
|
+
import { cedarApiImportGuardPlugin } from "./plugins/vite-plugin-cedar-api-import-guard.js";
|
|
17
|
+
import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
9
18
|
import { cedarCellTransform } from "./plugins/vite-plugin-cedar-cell.js";
|
|
19
|
+
import { cedarDataUriShim } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
|
|
10
20
|
import { cedarEntryInjectionPlugin } from "./plugins/vite-plugin-cedar-entry-injection.js";
|
|
11
21
|
import { cedarHtmlEnvPlugin } from "./plugins/vite-plugin-cedar-html-env.js";
|
|
12
|
-
import {
|
|
22
|
+
import { cedarMockCellDataPlugin } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
|
|
13
23
|
import { cedarRemoveDevFatalErrorPage } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
|
|
14
24
|
import { cedarRemoveFromBundle } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
|
|
15
25
|
import { cedarRoutesAutoLoaderPlugin } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
|
|
@@ -18,40 +28,54 @@ import { cedarjsResolveCedarStyleImportsPlugin } from "./plugins/vite-plugin-ced
|
|
|
18
28
|
import { cedarTransformJsAsJsx } from "./plugins/vite-plugin-jsx-loader.js";
|
|
19
29
|
import { cedarMergedConfig } from "./plugins/vite-plugin-merged-config.js";
|
|
20
30
|
import { cedarSwapApolloProvider } from "./plugins/vite-plugin-swap-apollo-provider.js";
|
|
21
|
-
import {
|
|
31
|
+
import { cedarApiImportGuardPlugin as cedarApiImportGuardPlugin2 } from "./plugins/vite-plugin-cedar-api-import-guard.js";
|
|
32
|
+
import { cedarAutoImportsPlugin as cedarAutoImportsPlugin2 } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
22
33
|
import { cedarCjsCompatPlugin } from "./plugins/vite-plugin-cedar-cjs-compat.js";
|
|
23
34
|
import { cedarCellTransform as cedarCellTransform2 } from "./plugins/vite-plugin-cedar-cell.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
35
|
+
import { cedarGqlormInjectPlugin } from "./plugins/vite-plugin-cedar-gqlorm-inject.js";
|
|
36
|
+
import { cedarGraphqlOptionsExtractPlugin } from "./plugins/vite-plugin-cedar-graphql-options-extract.js";
|
|
37
|
+
import { cedarOtelWrappingPlugin } from "./plugins/vite-plugin-cedar-otel-wrapping.js";
|
|
38
|
+
import {
|
|
39
|
+
applyHandlerAlsWrapping,
|
|
40
|
+
handlerAlsWrappingPlugin
|
|
41
|
+
} from "./plugins/vite-plugin-handler-als-wrapping.js";
|
|
26
42
|
import { cedarEntryInjectionPlugin as cedarEntryInjectionPlugin2 } from "./plugins/vite-plugin-cedar-entry-injection.js";
|
|
27
43
|
import { cedarHtmlEnvPlugin as cedarHtmlEnvPlugin2 } from "./plugins/vite-plugin-cedar-html-env.js";
|
|
44
|
+
import { cedarDirectoryNamedImportPlugin } from "./plugins/vite-plugin-cedar-directory-named-import.js";
|
|
28
45
|
import { cedarImportDirPlugin } from "./plugins/vite-plugin-cedar-import-dir.js";
|
|
29
|
-
import {
|
|
46
|
+
import { cedarDataUriShim as cedarDataUriShim2 } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
|
|
30
47
|
import { cedarRemoveDevFatalErrorPage as cedarRemoveDevFatalErrorPage2 } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
|
|
31
48
|
import { cedarRoutesAutoLoaderPlugin as cedarRoutesAutoLoaderPlugin2 } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
|
|
32
49
|
import { cedarRemoveFromBundle as cedarRemoveFromBundle2 } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
|
|
33
50
|
import { cedarjsResolveCedarStyleImportsPlugin as cedarjsResolveCedarStyleImportsPlugin2 } from "./plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js";
|
|
34
51
|
import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
|
|
52
|
+
import { cedarMockCellDataPlugin as cedarMockCellDataPlugin2 } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
|
|
35
53
|
import { cedarTransformJsAsJsx as cedarTransformJsAsJsx2 } from "./plugins/vite-plugin-jsx-loader.js";
|
|
36
54
|
import { cedarMergedConfig as cedarMergedConfig2 } from "./plugins/vite-plugin-merged-config.js";
|
|
37
55
|
import { cedarSwapApolloProvider as cedarSwapApolloProvider2 } from "./plugins/vite-plugin-swap-apollo-provider.js";
|
|
38
56
|
import { cedarUniversalDeployPlugin } from "./plugins/vite-plugin-cedar-universal-deploy.js";
|
|
39
57
|
import { cedarWaitForApiServer as cedarWaitForApiServer2 } from "./plugins/vite-plugin-cedar-wait-for-api-server.js";
|
|
40
|
-
function cedar({ mode } = {}) {
|
|
58
|
+
function cedar({ mode, babel } = {}) {
|
|
41
59
|
const cedarConfig = getConfig();
|
|
42
60
|
const rscEnabled = cedarConfig.experimental?.rsc?.enabled;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
...
|
|
48
|
-
};
|
|
61
|
+
const reactCompilerEnabled = cedarConfig.experimental?.reactCompiler?.enabled && cedarConfig.experimental?.reactCompiler?.lintOnly === false;
|
|
62
|
+
const compilerPlugins = reactCompilerEnabled ? [["babel-plugin-react-compiler", { target: "19" }]] : [];
|
|
63
|
+
const babelConfig = reactCompilerEnabled || babel ? {
|
|
64
|
+
...babel,
|
|
65
|
+
plugins: [...compilerPlugins, ...babel?.plugins ?? []]
|
|
66
|
+
} : void 0;
|
|
49
67
|
return [
|
|
68
|
+
// Has to come before tsconfigPaths(), which would otherwise resolve
|
|
69
|
+
// `$api/*` imports using the project's web/tsconfig.json `paths` mapping
|
|
70
|
+
cedarApiImportGuardPlugin(),
|
|
71
|
+
tsconfigPaths(),
|
|
72
|
+
gqlTagPlugin(),
|
|
50
73
|
mode === "test" && cedarJsRouterImportTransformPlugin(),
|
|
51
74
|
mode === "test" && createAuthImportTransformPlugin(),
|
|
52
75
|
mode === "test" && autoImportsPlugin(),
|
|
76
|
+
mode === "test" && cedarVitestWebConfigPlugin(),
|
|
53
77
|
cedarWaitForApiServer(),
|
|
54
|
-
|
|
78
|
+
cedarDataUriShim(),
|
|
55
79
|
cedarHtmlEnvPlugin(),
|
|
56
80
|
cedarEntryInjectionPlugin(),
|
|
57
81
|
cedarMergedConfig(),
|
|
@@ -63,22 +87,29 @@ function cedar({ mode } = {}) {
|
|
|
63
87
|
cedarRemoveDevFatalErrorPage(),
|
|
64
88
|
// RSC handles route auto-loading differently in each build stage
|
|
65
89
|
!rscEnabled && cedarRoutesAutoLoaderPlugin(),
|
|
90
|
+
cedarMockCellDataPlugin(),
|
|
91
|
+
cedarAutoImportsPlugin(),
|
|
66
92
|
react({ babel: babelConfig })
|
|
67
93
|
];
|
|
68
94
|
}
|
|
69
95
|
var index_default = cedar;
|
|
70
96
|
export {
|
|
71
|
-
|
|
97
|
+
applyHandlerAlsWrapping,
|
|
72
98
|
cedar,
|
|
73
|
-
|
|
99
|
+
cedarApiImportGuardPlugin2 as cedarApiImportGuardPlugin,
|
|
100
|
+
cedarAutoImportsPlugin2 as cedarAutoImportsPlugin,
|
|
74
101
|
cedarCellTransform2 as cedarCellTransform,
|
|
75
102
|
cedarCjsCompatPlugin,
|
|
76
|
-
|
|
103
|
+
cedarDataUriShim2 as cedarDataUriShim,
|
|
104
|
+
cedarDirectoryNamedImportPlugin,
|
|
77
105
|
cedarEntryInjectionPlugin2 as cedarEntryInjectionPlugin,
|
|
106
|
+
cedarGqlormInjectPlugin,
|
|
107
|
+
cedarGraphqlOptionsExtractPlugin,
|
|
78
108
|
cedarHtmlEnvPlugin2 as cedarHtmlEnvPlugin,
|
|
79
109
|
cedarImportDirPlugin,
|
|
80
110
|
cedarMergedConfig2 as cedarMergedConfig,
|
|
81
|
-
|
|
111
|
+
cedarMockCellDataPlugin2 as cedarMockCellDataPlugin,
|
|
112
|
+
cedarOtelWrappingPlugin,
|
|
82
113
|
cedarRemoveDevFatalErrorPage2 as cedarRemoveDevFatalErrorPage,
|
|
83
114
|
cedarRemoveFromBundle2 as cedarRemoveFromBundle,
|
|
84
115
|
cedarRoutesAutoLoaderPlugin2 as cedarRoutesAutoLoaderPlugin,
|
|
@@ -88,5 +119,6 @@ export {
|
|
|
88
119
|
cedarWaitForApiServer2 as cedarWaitForApiServer,
|
|
89
120
|
cedarjsJobPathInjectorPlugin,
|
|
90
121
|
cedarjsResolveCedarStyleImportsPlugin2 as cedarjsResolveCedarStyleImportsPlugin,
|
|
91
|
-
index_default as default
|
|
122
|
+
index_default as default,
|
|
123
|
+
handlerAlsWrappingPlugin
|
|
92
124
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SourceMap } from 'magic-string';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a sourcemap for a string transform by diffing its input and
|
|
4
|
+
* output. Used for transforms that don't produce a map themselves.
|
|
5
|
+
*
|
|
6
|
+
* The diff first anchors on the common prefix and suffix lines, then aligns
|
|
7
|
+
* the remaining lines with an LCS so that unchanged lines *inside* the
|
|
8
|
+
* changed region (e.g. statements inside a newly inserted wrapper) also map
|
|
9
|
+
* exactly. Aligned line pairs that differ are refined with a character-level
|
|
10
|
+
* prefix/suffix diff, which gives exact column mappings for in-place
|
|
11
|
+
* rewrites (e.g. import specifier rewrites) — including the columns after
|
|
12
|
+
* the rewritten span. Only lines with no counterpart at all map coarsely, to
|
|
13
|
+
* the start of their surrounding edit.
|
|
14
|
+
*
|
|
15
|
+
* Returns null when the input and output are identical.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateDiffSourceMap(original: string, transformed: string): SourceMap | null;
|
|
18
|
+
//# sourceMappingURL=generateDiffSourceMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateDiffSourceMap.d.ts","sourceRoot":"","sources":["../../src/lib/generateDiffSourceMap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAc7C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,SAAS,GAAG,IAAI,CA0DlB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import MagicString from "magic-string";
|
|
2
|
+
const MAX_ALIGNMENT_CELLS = 1e6;
|
|
3
|
+
function generateDiffSourceMap(original, transformed) {
|
|
4
|
+
if (original === transformed) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const ms = new MagicString(original);
|
|
8
|
+
const origLines = original.split("\n");
|
|
9
|
+
const newLines = transformed.split("\n");
|
|
10
|
+
const lineOffsets = new Array(origLines.length);
|
|
11
|
+
let offset = 0;
|
|
12
|
+
for (let i = 0; i < origLines.length; i++) {
|
|
13
|
+
lineOffsets[i] = offset;
|
|
14
|
+
offset += origLines[i].length + 1;
|
|
15
|
+
}
|
|
16
|
+
let prefix = 0;
|
|
17
|
+
const maxPrefix = Math.min(origLines.length, newLines.length);
|
|
18
|
+
while (prefix < maxPrefix && origLines[prefix] === newLines[prefix]) {
|
|
19
|
+
prefix++;
|
|
20
|
+
}
|
|
21
|
+
let suffix = 0;
|
|
22
|
+
const maxSuffix = Math.min(origLines.length, newLines.length) - prefix;
|
|
23
|
+
while (suffix < maxSuffix && origLines[origLines.length - 1 - suffix] === newLines[newLines.length - 1 - suffix]) {
|
|
24
|
+
suffix++;
|
|
25
|
+
}
|
|
26
|
+
const hunks = alignLines(
|
|
27
|
+
origLines,
|
|
28
|
+
prefix,
|
|
29
|
+
origLines.length - suffix,
|
|
30
|
+
newLines,
|
|
31
|
+
prefix,
|
|
32
|
+
newLines.length - suffix
|
|
33
|
+
);
|
|
34
|
+
for (const hunk of hunks) {
|
|
35
|
+
applyHunk(ms, hunk, origLines, newLines, lineOffsets, original.length);
|
|
36
|
+
}
|
|
37
|
+
if (ms.toString() !== transformed) {
|
|
38
|
+
return new MagicString(original).generateMap({ hires: true });
|
|
39
|
+
}
|
|
40
|
+
return ms.generateMap({ hires: true });
|
|
41
|
+
}
|
|
42
|
+
function alignLines(origLines, oLo, oHi, newLines, nLo, nHi) {
|
|
43
|
+
const m = oHi - oLo;
|
|
44
|
+
const n = nHi - nLo;
|
|
45
|
+
if (m === 0 && n === 0) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
if (m === 0 || n === 0 || m * n > MAX_ALIGNMENT_CELLS) {
|
|
49
|
+
return [{ oStart: oLo, oEnd: oHi, nStart: nLo, nEnd: nHi }];
|
|
50
|
+
}
|
|
51
|
+
const width = n + 1;
|
|
52
|
+
const dp = new Int32Array((m + 1) * width);
|
|
53
|
+
for (let i2 = m - 1; i2 >= 0; i2--) {
|
|
54
|
+
for (let j2 = n - 1; j2 >= 0; j2--) {
|
|
55
|
+
dp[i2 * width + j2] = origLines[oLo + i2] === newLines[nLo + j2] ? dp[(i2 + 1) * width + j2 + 1] + 1 : Math.max(dp[(i2 + 1) * width + j2], dp[i2 * width + j2 + 1]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const hunks = [];
|
|
59
|
+
let i = 0;
|
|
60
|
+
let j = 0;
|
|
61
|
+
let hunkO = 0;
|
|
62
|
+
let hunkN = 0;
|
|
63
|
+
const flushHunk = () => {
|
|
64
|
+
if (i > hunkO || j > hunkN) {
|
|
65
|
+
hunks.push({
|
|
66
|
+
oStart: oLo + hunkO,
|
|
67
|
+
oEnd: oLo + i,
|
|
68
|
+
nStart: nLo + hunkN,
|
|
69
|
+
nEnd: nLo + j
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
while (i < m && j < n) {
|
|
74
|
+
if (origLines[oLo + i] === newLines[nLo + j]) {
|
|
75
|
+
flushHunk();
|
|
76
|
+
i++;
|
|
77
|
+
j++;
|
|
78
|
+
hunkO = i;
|
|
79
|
+
hunkN = j;
|
|
80
|
+
} else if (dp[(i + 1) * width + j] >= dp[i * width + j + 1]) {
|
|
81
|
+
i++;
|
|
82
|
+
} else {
|
|
83
|
+
j++;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
i = m;
|
|
87
|
+
j = n;
|
|
88
|
+
flushHunk();
|
|
89
|
+
return hunks;
|
|
90
|
+
}
|
|
91
|
+
function applyHunk(ms, { oStart, oEnd, nStart, nEnd }, origLines, newLines, lineOffsets, originalLength) {
|
|
92
|
+
const oCount = oEnd - oStart;
|
|
93
|
+
const nCount = nEnd - nStart;
|
|
94
|
+
const newSlice = newLines.slice(nStart, nEnd);
|
|
95
|
+
if (oCount === nCount) {
|
|
96
|
+
for (let k = 0; k < oCount; k++) {
|
|
97
|
+
diffLinePair(
|
|
98
|
+
ms,
|
|
99
|
+
lineOffsets[oStart + k],
|
|
100
|
+
origLines[oStart + k],
|
|
101
|
+
newLines[nStart + k]
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
} else if (oCount === 0) {
|
|
105
|
+
const text = newSlice.join("\n");
|
|
106
|
+
if (oStart >= origLines.length) {
|
|
107
|
+
ms.appendLeft(originalLength, "\n" + text);
|
|
108
|
+
} else {
|
|
109
|
+
ms.appendLeft(lineOffsets[oStart], text + "\n");
|
|
110
|
+
}
|
|
111
|
+
} else if (nCount === 0) {
|
|
112
|
+
const start = lineOffsets[oStart];
|
|
113
|
+
if (oEnd >= origLines.length) {
|
|
114
|
+
ms.remove(oStart > 0 ? start - 1 : start, originalLength);
|
|
115
|
+
} else {
|
|
116
|
+
ms.remove(start, lineOffsets[oEnd]);
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
const start = lineOffsets[oStart];
|
|
120
|
+
const end = lineOffsets[oEnd - 1] + origLines[oEnd - 1].length;
|
|
121
|
+
ms.overwrite(start, end, newSlice.join("\n"));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function diffLinePair(ms, lineStart, origLine, newLine) {
|
|
125
|
+
if (origLine === newLine) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
let charPrefix = 0;
|
|
129
|
+
const maxCharPrefix = Math.min(origLine.length, newLine.length);
|
|
130
|
+
while (charPrefix < maxCharPrefix && origLine[charPrefix] === newLine[charPrefix]) {
|
|
131
|
+
charPrefix++;
|
|
132
|
+
}
|
|
133
|
+
let charSuffix = 0;
|
|
134
|
+
const maxCharSuffix = Math.min(origLine.length, newLine.length) - charPrefix;
|
|
135
|
+
while (charSuffix < maxCharSuffix && origLine[origLine.length - 1 - charSuffix] === newLine[newLine.length - 1 - charSuffix]) {
|
|
136
|
+
charSuffix++;
|
|
137
|
+
}
|
|
138
|
+
const start = lineStart + charPrefix;
|
|
139
|
+
const end = lineStart + origLine.length - charSuffix;
|
|
140
|
+
const replacement = newLine.slice(charPrefix, newLine.length - charSuffix);
|
|
141
|
+
if (start === end) {
|
|
142
|
+
ms.appendLeft(start, replacement);
|
|
143
|
+
} else if (replacement === "") {
|
|
144
|
+
ms.remove(start, end);
|
|
145
|
+
} else {
|
|
146
|
+
ms.overwrite(start, end, replacement);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export {
|
|
150
|
+
generateDiffSourceMap
|
|
151
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAS5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAC5D,YAAY,cAAc,EAAE,KAAK,SAAS,KAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAS5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAC5D,YAAY,cAAc,EAAE,KAAK,SAAS,KAAG,cAAc,CAgIpE"}
|
|
@@ -25,6 +25,10 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
25
25
|
resolve: {
|
|
26
26
|
alias: {
|
|
27
27
|
...workspaceAliases,
|
|
28
|
+
// $api/ bare specifiers (e.g. "from '$api/src/lib/db'") are
|
|
29
|
+
// resolved by cedarjsResolveCedarStyleImportsPlugin, which is
|
|
30
|
+
// always included alongside this config in cedar()'s plugin list
|
|
31
|
+
// (see packages/vite/src/index.ts) — no alias needed here too.
|
|
28
32
|
// In test mode, register the virtual module alias so that
|
|
29
33
|
// MockProviders can resolve the user's Routes file
|
|
30
34
|
...env.mode === "test" ? { "~__CEDAR__USER_ROUTES_FOR_MOCK": cedarPaths.web.routes } : {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* `$api/` imports resolve to files on the api side. They're only supported in
|
|
4
|
+
* `*.routeHooks.{js,ts}` files and in scripts run with `yarn cedar exec` – both
|
|
5
|
+
* of which run on the server. This plugin makes a `$api/` import from code that
|
|
6
|
+
* ends up in the browser bundle fail with an explanatory error instead of
|
|
7
|
+
* silently bundling server-only code (like the Prisma client) into the browser.
|
|
8
|
+
*
|
|
9
|
+
* Has to run before `vite-tsconfig-paths`, which would otherwise resolve
|
|
10
|
+
* `$api/*` using the `paths` mapping in the project's `web/tsconfig.json`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function cedarApiImportGuardPlugin(): Plugin;
|
|
13
|
+
//# sourceMappingURL=vite-plugin-cedar-api-import-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-api-import-guard.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-api-import-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CA0BlD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function cedarApiImportGuardPlugin() {
|
|
2
|
+
return {
|
|
3
|
+
name: "cedar-api-import-guard",
|
|
4
|
+
enforce: "pre",
|
|
5
|
+
resolveId(id, importer) {
|
|
6
|
+
if (this.environment?.name !== "client" || !id.startsWith("$api/")) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
throw new Error(
|
|
10
|
+
`Cannot import "${id}" from client-side code` + (importer ? ` (imported by "${importer}")` : "") + '.\n\n"$api/" imports resolve to your api side, which must never end up in the browser bundle. They\'re only supported in server-side code, like *.routeHooks.{js,ts} files and scripts run with `yarn cedar exec`.\n\nIf you need this data in the browser, fetch it through GraphQL instead.'
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
cedarApiImportGuardPlugin
|
|
17
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function cedarAutoImportsPlugin():
|
|
1
|
+
export declare function cedarAutoImportsPlugin(): any[];
|
|
2
2
|
//# sourceMappingURL=vite-plugin-cedar-auto-import.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-auto-import.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-auto-import.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-auto-import.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-auto-import.ts"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,UA2ErC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
2
|
+
import unimportPluginMod from "unimport/unplugin";
|
|
3
|
+
const unimportPlugin = (
|
|
4
|
+
// @ts-expect-error – .default only exists at runtime in CJS double-wrap
|
|
5
|
+
// interop
|
|
6
|
+
unimportPluginMod.default?.default || // @ts-expect-error – .default only exists at runtime in CJS double-wrap
|
|
7
|
+
// interop
|
|
8
|
+
unimportPluginMod.default || unimportPluginMod
|
|
9
|
+
);
|
|
3
10
|
import autoImport from "unplugin-auto-import/vite";
|
|
4
11
|
import {
|
|
5
12
|
getConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAqBlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAsK3C"}
|
|
@@ -7,6 +7,7 @@ const generate = babelGenerator.default || babelGenerator;
|
|
|
7
7
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
8
8
|
"beforeQuery",
|
|
9
9
|
"QUERY",
|
|
10
|
+
"FRAGMENT",
|
|
10
11
|
"data",
|
|
11
12
|
"isEmpty",
|
|
12
13
|
"afterQuery",
|
|
@@ -64,7 +65,7 @@ function cedarCellTransform() {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
|
-
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
|
|
68
|
+
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("FRAGMENT") || exportNames.includes("data");
|
|
68
69
|
if (hasDefaultExport || !hasQueryOrDataExport) {
|
|
69
70
|
return null;
|
|
70
71
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-data-uri-shim.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-data-uri-shim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAgClC,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CA4BrD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getConfig } from "@cedarjs/project-config";
|
|
2
|
+
function dataUriToBuffer(uri) {
|
|
3
|
+
const match = uri.match(/^data:(.*?)(;(.*?))?(,(.*))$/);
|
|
4
|
+
if (!match) {
|
|
5
|
+
throw new Error("Invalid data URI");
|
|
6
|
+
}
|
|
7
|
+
const mediaType = match[1] || "text/plain";
|
|
8
|
+
const params = match[3] || "";
|
|
9
|
+
const data = match[5];
|
|
10
|
+
const [type] = mediaType.split(";");
|
|
11
|
+
const typeFull = params ? mediaType + ";" + params : mediaType;
|
|
12
|
+
const lowerParams = params.toLowerCase();
|
|
13
|
+
const isBase64 = lowerParams.includes("base64");
|
|
14
|
+
const charset = lowerParams.startsWith("charset=") ? lowerParams.slice(8) : "";
|
|
15
|
+
const bytes = isBase64 ? Uint8Array.from(atob(data), (c) => c.charCodeAt(0)) : new TextEncoder().encode(decodeURIComponent(data));
|
|
16
|
+
const decoder = new TextDecoder();
|
|
17
|
+
bytes.toString = () => decoder.decode(bytes);
|
|
18
|
+
return Object.assign(bytes, { type, typeFull, charset });
|
|
19
|
+
}
|
|
20
|
+
function cedarDataUriShim() {
|
|
21
|
+
if (getConfig().experimental?.rsc?.enabled) {
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
name: "cedar-data-uri-shim",
|
|
26
|
+
apply: "serve",
|
|
27
|
+
resolveId(id) {
|
|
28
|
+
if (id === "data-uri-to-buffer") {
|
|
29
|
+
return "\0cedar-data-uri-to-buffer";
|
|
30
|
+
}
|
|
31
|
+
return void 0;
|
|
32
|
+
},
|
|
33
|
+
load(id) {
|
|
34
|
+
if (id === "\0cedar-data-uri-to-buffer") {
|
|
35
|
+
return "export default " + dataUriToBuffer.toString();
|
|
36
|
+
}
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
cedarDataUriShim
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves bare directory imports to the index file or directory-named module.
|
|
4
|
+
*
|
|
5
|
+
* When you import `./Button`, this plugin checks:
|
|
6
|
+
* 1. `./Button/index.[js|ts|tsx|jsx|...]` — preferred if it exists
|
|
7
|
+
* 2. `./Button/Button.[js|ts|tsx|jsx|...]` — directory-named module fallback
|
|
8
|
+
*
|
|
9
|
+
* This mirrors the behaviour of babel-plugin-redwood-directory-named-import.
|
|
10
|
+
*/
|
|
11
|
+
export declare function cedarDirectoryNamedImportPlugin(): Plugin;
|
|
12
|
+
//# sourceMappingURL=vite-plugin-cedar-directory-named-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-directory-named-import.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-directory-named-import.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CA0CxD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { normalizePath } from "vite";
|
|
3
|
+
import { resolveFile } from "@cedarjs/project-config";
|
|
4
|
+
function cedarDirectoryNamedImportPlugin() {
|
|
5
|
+
return {
|
|
6
|
+
name: "vite-plugin-cedar-directory-named-import",
|
|
7
|
+
resolveId(id, importer) {
|
|
8
|
+
if (!id.startsWith(".") || !importer) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (normalizePath(importer).includes("/node_modules/")) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const absolutePath = path.resolve(path.dirname(importer), id);
|
|
15
|
+
if (resolveFile(absolutePath)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const basename = path.basename(absolutePath);
|
|
19
|
+
const indexPath = absolutePath + "/index";
|
|
20
|
+
const resolvedIndex = resolveFile(indexPath);
|
|
21
|
+
if (resolvedIndex) {
|
|
22
|
+
return normalizePath(resolvedIndex);
|
|
23
|
+
}
|
|
24
|
+
const dirnamedPath = absolutePath + "/" + basename;
|
|
25
|
+
const resolvedDirnamed = resolveFile(dirnamedPath);
|
|
26
|
+
if (resolvedDirnamed) {
|
|
27
|
+
return normalizePath(resolvedDirnamed);
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
cedarDirectoryNamedImportPlugin
|
|
35
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Vite plugin that injects the auto-generated gqlorm backend into
|
|
4
|
+
* `api/src/functions/graphql.ts` at build time.
|
|
5
|
+
*
|
|
6
|
+
* When `experimental.gqlorm.enabled = true` and `.cedar/gqlorm/backend.ts`
|
|
7
|
+
* exists, this plugin:
|
|
8
|
+
*
|
|
9
|
+
* 1. Adds imports at the top of graphql.ts:
|
|
10
|
+
* import * as __gqlorm_sdl__ from '../../../.cedar/gqlorm/backend'
|
|
11
|
+
* import { db as __gqlorm_db__ } from 'src/lib/db'
|
|
12
|
+
*
|
|
13
|
+
* 2. Inserts a statement immediately before the `createGraphQLHandler` call:
|
|
14
|
+
* Object.assign(sdls, {
|
|
15
|
+
* __gqlorm__: {
|
|
16
|
+
* schema: __gqlorm_sdl__.schema,
|
|
17
|
+
* resolvers: __gqlorm_sdl__.createGqlormResolvers(__gqlorm_db__),
|
|
18
|
+
* },
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* The `sdls` variable is already a `let` binding because
|
|
22
|
+
* `vite-plugin-cedar-import-dir` transforms the glob import
|
|
23
|
+
* `import sdls from 'src/graphql/**\/*.sdl.{js,ts}'` into `let sdls = {}`.
|
|
24
|
+
*
|
|
25
|
+
* This plugin is a no-op when gqlorm is disabled or the backend file does
|
|
26
|
+
* not exist.
|
|
27
|
+
*/
|
|
28
|
+
export declare function cedarGqlormInjectPlugin(): Plugin;
|
|
29
|
+
//# sourceMappingURL=vite-plugin-cedar-gqlorm-inject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-gqlorm-inject.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-gqlorm-inject.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAQlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAgHhD"}
|