@cedarjs/testing 7.0.0-canary.2989 → 7.0.0-canary.2991

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.
Files changed (65) hide show
  1. package/package.json +21 -52
  2. package/dist/cjs/api/apiFunction.d.ts +0 -37
  3. package/dist/cjs/api/apiFunction.d.ts.map +0 -1
  4. package/dist/cjs/api/apiFunction.js +0 -89
  5. package/dist/cjs/api/checkTestDatabase.d.ts +0 -23
  6. package/dist/cjs/api/checkTestDatabase.d.ts.map +0 -1
  7. package/dist/cjs/api/checkTestDatabase.js +0 -69
  8. package/dist/cjs/api/directive.d.ts +0 -51
  9. package/dist/cjs/api/directive.d.ts.map +0 -1
  10. package/dist/cjs/api/directive.js +0 -77
  11. package/dist/cjs/api/index.d.ts +0 -4
  12. package/dist/cjs/api/index.d.ts.map +0 -1
  13. package/dist/cjs/api/index.js +0 -26
  14. package/dist/cjs/api/mockContext.d.ts +0 -5
  15. package/dist/cjs/api/mockContext.d.ts.map +0 -1
  16. package/dist/cjs/api/mockContext.js +0 -58
  17. package/dist/cjs/api/scenario.d.ts +0 -108
  18. package/dist/cjs/api/scenario.d.ts.map +0 -1
  19. package/dist/cjs/api/scenario.js +0 -30
  20. package/dist/cjs/api/vitest/CedarApiVitestEnv.js +0 -75
  21. package/dist/cjs/api/vitest/index.js +0 -34
  22. package/dist/cjs/api/vitest/vite-plugin-auto-import.js +0 -71
  23. package/dist/cjs/api/vitest/vite-plugin-cedar-vitest-api-config.js +0 -69
  24. package/dist/cjs/api/vitest/vite-plugin-track-db-imports.js +0 -47
  25. package/dist/cjs/api/vitest/vitest-api.setup.js +0 -270
  26. package/dist/cjs/cache/index.d.ts +0 -50
  27. package/dist/cjs/cache/index.d.ts.map +0 -1
  28. package/dist/cjs/cache/index.js +0 -104
  29. package/dist/cjs/package.json +0 -1
  30. package/dist/cjs/web/MockParamsProvider.d.ts +0 -7
  31. package/dist/cjs/web/MockParamsProvider.d.ts.map +0 -1
  32. package/dist/cjs/web/MockParamsProvider.js +0 -44
  33. package/dist/cjs/web/MockProviders.d.ts +0 -5
  34. package/dist/cjs/web/MockProviders.d.ts.map +0 -1
  35. package/dist/cjs/web/MockProviders.js +0 -66
  36. package/dist/cjs/web/MockRouter.d.ts +0 -11
  37. package/dist/cjs/web/MockRouter.d.ts.map +0 -1
  38. package/dist/cjs/web/MockRouter.js +0 -48
  39. package/dist/cjs/web/customRender.d.ts +0 -6
  40. package/dist/cjs/web/customRender.d.ts.map +0 -1
  41. package/dist/cjs/web/customRender.js +0 -54
  42. package/dist/cjs/web/findCellMocks.d.ts +0 -2
  43. package/dist/cjs/web/findCellMocks.d.ts.map +0 -1
  44. package/dist/cjs/web/findCellMocks.js +0 -45
  45. package/dist/cjs/web/globRoutesImporter.d.ts +0 -13
  46. package/dist/cjs/web/globRoutesImporter.d.ts.map +0 -1
  47. package/dist/cjs/web/globRoutesImporter.js +0 -46
  48. package/dist/cjs/web/global.d.ts +0 -6
  49. package/dist/cjs/web/global.d.ts.map +0 -1
  50. package/dist/cjs/web/global.js +0 -1
  51. package/dist/cjs/web/index.d.ts +0 -6
  52. package/dist/cjs/web/index.d.ts.map +0 -1
  53. package/dist/cjs/web/index.js +0 -41
  54. package/dist/cjs/web/mockAuth.d.ts +0 -29
  55. package/dist/cjs/web/mockAuth.d.ts.map +0 -1
  56. package/dist/cjs/web/mockAuth.js +0 -89
  57. package/dist/cjs/web/mockRequests.d.ts +0 -72
  58. package/dist/cjs/web/mockRequests.d.ts.map +0 -1
  59. package/dist/cjs/web/mockRequests.js +0 -210
  60. package/dist/cjs/web/vitest/index.js +0 -37
  61. package/dist/cjs/web/vitest/vite-plugin-auto-import.js +0 -60
  62. package/dist/cjs/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -51
  63. package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.js +0 -42
  64. package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.js +0 -43
  65. package/dist/cjs/web/vitest/vitest-web.setup.js +0 -19
@@ -1,108 +0,0 @@
1
- import type { A } from 'ts-toolbelt';
2
- /**
3
- * Use this function to define your scenario.
4
- *
5
- * @example
6
- * export const standard = defineScenario({
7
- * user: {
8
- * dom: {
9
- * name: 'Dom Saadi',
10
- * email: 'dom@cedarjs.com',
11
- * },
12
- * },
13
- * })
14
- *
15
- * @example
16
- * export const standard = defineScenario<Prisma.CreateUserArgs>({
17
- * user: {
18
- * dom: {
19
- * name: 'Dom Saadi',
20
- * email: 'dom@cedarjs.com',
21
- * },
22
- * },
23
- * })
24
- */
25
- export declare const defineScenario: DefineScenario;
26
- /**
27
- * @example
28
- * {
29
- * dannyUser: {
30
- * data: {
31
- * id: 1,
32
- * name: 'Danny',
33
- * },
34
- * },
35
- * }
36
- *
37
- * @example
38
- * krisUser: (scenario) => {
39
- * return {
40
- * data: {
41
- * id: 2,
42
- * name: 'Kris',
43
- * },
44
- * }
45
- * }
46
- */
47
- type ScenarioDefinitionMap<PrismaCreateType extends {
48
- data: any;
49
- }, ModelName extends string | number | symbol = string | number | symbol, TKeys extends string | number | symbol = string | number | symbol> = Record<TKeys, A.Compute<PrismaCreateType> | ((scenario: Record<ModelName, Record<TKeys, any>>) => A.Compute<PrismaCreateType>)>;
50
- export interface DefineScenario {
51
- <PrismaCreateType extends {
52
- data: any;
53
- }, ModelName extends string | number | symbol = string | number | symbol, TKeys extends string | number | symbol = string | number | symbol>(scenarioMap: Record<ModelName, ScenarioDefinitionMap<PrismaCreateType, ModelName, TKeys>>): Record<ModelName, Record<TKeys, any>>;
54
- }
55
- /**
56
- * Type of data seeded by the scenario. Use this type to get the 'strict' return type of defineScenario
57
- *
58
- * @example
59
- * import { Product } from '@prisma/client'
60
- *
61
- * // If you scenario looks like this:
62
- * export const standard = defineScenario({
63
- * product: {
64
- * shirt: {
65
- * id: 55,
66
- * price: 10,
67
- * },
68
- * },
69
- * })
70
- *
71
- * // Export the StandardScenario type as
72
- * export StandardScenario = ScenarioData<Product, 'product'>
73
- *
74
- * // You can also define each of the keys in your scenario, so you get stricter type checking
75
- * export StandardScenario = ScenarioData<Product, 'product', 'shirt'>
76
- */
77
- export declare type ScenarioData<TModel, // the prisma model, imported from @prisma/client e.g. "Product"
78
- TName extends string | number = string | number, // (optional) name of the prisma model e.g. "product"
79
- TKeys extends string | number = string | number> = Record<TName, Record<TKeys, TModel>>;
80
- interface TestFunctionWithScenario<TData> {
81
- (scenario?: TData): Promise<void>;
82
- }
83
- interface DescribeBlockWithGetScenario<TData> {
84
- (getScenario: () => TData): void;
85
- }
86
- export interface Scenario {
87
- (title: string, testFunction: TestFunctionWithScenario<any>): void;
88
- }
89
- export interface Scenario {
90
- (namedScenario: string, title: string, testFunction: TestFunctionWithScenario<any>): void;
91
- }
92
- export interface Scenario {
93
- only: Scenario;
94
- }
95
- export interface DescribeScenario {
96
- <TData = any>(title: string, describeBlock: DescribeBlockWithGetScenario<TData>): void;
97
- }
98
- export interface DescribeScenario {
99
- <TData>(title: string, describeBlock: DescribeBlockWithGetScenario<TData>): void;
100
- }
101
- export interface DescribeScenario {
102
- <TData>(namedScenario: string, title: string, describeBlock: DescribeBlockWithGetScenario<TData>): void;
103
- }
104
- export interface DescribeScenario {
105
- only: DescribeScenario;
106
- }
107
- export {};
108
- //# sourceMappingURL=scenario.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../../src/api/scenario.ts"],"names":[],"mappings":"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"}
@@ -1,30 +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 scenario_exports = {};
20
- __export(scenario_exports, {
21
- defineScenario: () => defineScenario
22
- });
23
- module.exports = __toCommonJS(scenario_exports);
24
- const defineScenario = (data) => {
25
- return data;
26
- };
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- defineScenario
30
- });
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var CedarApiVitestEnv_exports = {};
30
- __export(CedarApiVitestEnv_exports, {
31
- default: () => CedarApiVitestEnv_default
32
- });
33
- module.exports = __toCommonJS(CedarApiVitestEnv_exports);
34
- var import_node_path = __toESM(require("node:path"), 1);
35
- var import_config = require("dotenv-defaults/config.js");
36
- var import_execa = __toESM(require("execa"), 1);
37
- var import_project_config = require("@cedarjs/project-config");
38
- var import_packageManager = require("@cedarjs/project-config/packageManager");
39
- var import_checkTestDatabase = require("../checkTestDatabase.js");
40
- const CedarApiVitestEnvironment = {
41
- name: "cedar-api",
42
- viteEnvironment: "ssr",
43
- async setup() {
44
- if (process.env.SKIP_DB_PUSH === "1") {
45
- return {
46
- teardown() {
47
- }
48
- };
49
- }
50
- const cedarPaths = (0, import_project_config.getPaths)();
51
- const defaultDb = `file:${import_node_path.default.join(cedarPaths.generated.base, "test.db")}`;
52
- const usedFallback = !process.env.TEST_DATABASE_URL;
53
- process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
54
- await (0, import_checkTestDatabase.checkTestDatabaseUrlMatchesProvider)(
55
- process.env.DATABASE_URL,
56
- usedFallback
57
- );
58
- console.log(
59
- `Setting up test database: ${(0, import_checkTestDatabase.redactDatabaseUrl)(process.env.DATABASE_URL)}`
60
- );
61
- const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
62
- const pm = (0, import_packageManager.getPackageManager)();
63
- const pmExec = pm === "pnpm" ? pm : "npx";
64
- import_execa.default.sync(pmExec, ["cedar", ...command], {
65
- cwd: cedarPaths.api.base,
66
- stdio: "inherit",
67
- env: process.env
68
- });
69
- return {
70
- teardown() {
71
- }
72
- };
73
- }
74
- };
75
- var CedarApiVitestEnv_default = CedarApiVitestEnvironment;
@@ -1,34 +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 vitest_exports = {};
20
- __export(vitest_exports, {
21
- autoImportsPlugin: () => import_vite_plugin_auto_import.autoImportsPlugin,
22
- cedarVitestApiConfigPlugin: () => import_vite_plugin_cedar_vitest_api_config.cedarVitestApiConfigPlugin,
23
- trackDbImportsPlugin: () => import_vite_plugin_track_db_imports.trackDbImportsPlugin
24
- });
25
- module.exports = __toCommonJS(vitest_exports);
26
- var import_vite_plugin_auto_import = require("./vite-plugin-auto-import.js");
27
- var import_vite_plugin_cedar_vitest_api_config = require("./vite-plugin-cedar-vitest-api-config.js");
28
- var import_vite_plugin_track_db_imports = require("./vite-plugin-track-db-imports.js");
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- autoImportsPlugin,
32
- cedarVitestApiConfigPlugin,
33
- trackDbImportsPlugin
34
- });
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var vite_plugin_auto_import_exports = {};
30
- __export(vite_plugin_auto_import_exports, {
31
- autoImportsPlugin: () => autoImportsPlugin
32
- });
33
- module.exports = __toCommonJS(vite_plugin_auto_import_exports);
34
- var import_vite = __toESM(require("unplugin-auto-import/vite"), 1);
35
- function autoImportsPlugin() {
36
- return (0, import_vite.default)({
37
- // targets to transform
38
- include: [
39
- /\.[tj]sx?$/
40
- // .ts, .tsx, .js, .jsx
41
- ],
42
- // global imports to register
43
- imports: [
44
- // import { mockContext, mockHttpEvent, mockSignedWebhook } from '@cedarjs/testing/api';
45
- {
46
- "@cedarjs/testing/api": [
47
- "mockContext",
48
- "mockHttpEvent",
49
- "mockSignedWebhook"
50
- ]
51
- },
52
- // import { gql } from 'graphql-tag'
53
- {
54
- "graphql-tag": ["gql"]
55
- },
56
- // import { context } from '@cedarjs/context'
57
- {
58
- "@cedarjs/context": ["context"]
59
- }
60
- ],
61
- // We provide our mocking types elsewhere and so don't need this plugin to
62
- // generate them.
63
- // TODO: Maybe we should have it at least generate the types for the gql
64
- // import? (Or do we already provide that some other way?)
65
- dts: false
66
- });
67
- }
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {
70
- autoImportsPlugin
71
- });
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var vite_plugin_cedar_vitest_api_config_exports = {};
30
- __export(vite_plugin_cedar_vitest_api_config_exports, {
31
- cedarVitestApiConfigPlugin: () => cedarVitestApiConfigPlugin
32
- });
33
- module.exports = __toCommonJS(vite_plugin_cedar_vitest_api_config_exports);
34
- var import_node_path = __toESM(require("node:path"), 1);
35
- var import_project_config = require("@cedarjs/project-config");
36
- const import_meta = {};
37
- function cedarVitestApiConfigPlugin() {
38
- return {
39
- name: "cedar-vitest-plugin",
40
- config: () => {
41
- return {
42
- define: (0, import_project_config.getEnvVarDefinitions)(),
43
- ssr: {
44
- noExternal: ["@cedarjs/testing"]
45
- },
46
- resolve: {
47
- alias: {
48
- src: (0, import_project_config.getPaths)().api.src
49
- }
50
- },
51
- test: {
52
- environment: import_node_path.default.join(import_meta.dirname, "CedarApiVitestEnv.js"),
53
- // All api test files share a single test database, so they can't
54
- // run in parallel. In Vitest 3 project-level fileParallelism didn't
55
- // work (https://github.com/vitest-dev/vitest/discussions/7416) and
56
- // we used the now-removed `poolOptions: { forks: { singleFork:
57
- // true } }` as a workaround. Vitest 4 removed `poolOptions` and
58
- // supports `fileParallelism` in project configs.
59
- fileParallelism: false,
60
- setupFiles: [import_node_path.default.join(import_meta.dirname, "vitest-api.setup.js")]
61
- }
62
- };
63
- }
64
- };
65
- }
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- cedarVitestApiConfigPlugin
69
- });
@@ -1,47 +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 vite_plugin_track_db_imports_exports = {};
20
- __export(vite_plugin_track_db_imports_exports, {
21
- trackDbImportsPlugin: () => trackDbImportsPlugin
22
- });
23
- module.exports = __toCommonJS(vite_plugin_track_db_imports_exports);
24
- function trackDbImportsPlugin() {
25
- return {
26
- name: "db-import-tracker",
27
- transform(code, id) {
28
- if (id.match(/\/api\/src\/lib\/db\.(js|ts)$/) && code.includes("PrismaClient")) {
29
- return code + `
30
- ;if (typeof globalThis !== "undefined") {
31
- globalThis.__cedarjs_db_imported__ = true;
32
- } else {
33
- throw new Error(
34
- "vite-plugin-track-db-imports: globalThis is undefined. " +
35
- "This is an error with CedarJS"
36
- );
37
- }
38
- `;
39
- }
40
- return code;
41
- }
42
- };
43
- }
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- trackDbImportsPlugin
47
- });