@cedarjs/vite 1.0.0-canary.12558 → 1.0.0-canary.12559

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.
@@ -34,7 +34,6 @@ module.exports = __toCommonJS(getMergedConfig_exports);
34
34
  var import_node_path = __toESM(require("node:path"), 1);
35
35
  var import_vite = require("vite");
36
36
  var import_project_config = require("@cedarjs/project-config");
37
- var import_envVarDefinitions = require("./envVarDefinitions.js");
38
37
  function getMergedConfig(rwConfig, rwPaths) {
39
38
  return (userConfig, env) => {
40
39
  let apiHost = process.env.REDWOOD_API_HOST;
@@ -69,7 +68,7 @@ function getMergedConfig(rwConfig, rwPaths) {
69
68
  // },
70
69
  envPrefix: "REDWOOD_ENV_",
71
70
  publicDir: import_node_path.default.join(rwPaths.web.base, "public"),
72
- define: (0, import_envVarDefinitions.getEnvVarDefinitions)(),
71
+ define: (0, import_project_config.getEnvVarDefinitions)(),
73
72
  css: {
74
73
  // @NOTE config path is relative to where vite.config.js is if you use
75
74
  // a relative path
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,21 +15,12 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
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
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var registerFwGlobalsAndShims_exports = {};
30
20
  __export(registerFwGlobalsAndShims_exports, {
31
21
  registerFwGlobalsAndShims: () => registerFwGlobalsAndShims
32
22
  });
33
23
  module.exports = __toCommonJS(registerFwGlobalsAndShims_exports);
34
- var import_node_path = __toESM(require("node:path"), 1);
35
24
  var import_project_config = require("@cedarjs/project-config");
36
25
  const registerFwGlobalsAndShims = () => {
37
26
  registerFwGlobals();
@@ -39,13 +28,9 @@ const registerFwGlobalsAndShims = () => {
39
28
  };
40
29
  function registerFwGlobals() {
41
30
  const rwConfig = (0, import_project_config.getConfig)();
42
- const rwPaths = (0, import_project_config.getPaths)();
31
+ const envVars = (0, import_project_config.getEnvVarDefinitions)();
43
32
  globalThis.RWJS_ENV = {
44
- RWJS_API_GRAPHQL_URL: rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql",
45
- RWJS_API_URL: rwConfig.web.apiUrl,
46
- __REDWOOD__APP_TITLE: rwConfig.web.title || import_node_path.default.basename(rwPaths.base),
47
- RWJS_EXP_STREAMING_SSR: rwConfig.experimental.streamingSsr?.enabled,
48
- RWJS_EXP_RSC: rwConfig.experimental?.rsc?.enabled,
33
+ ...envVars.RWJS_ENV,
49
34
  RWJS_EXP_SSR_GRAPHQL_ENDPOINT: (() => {
50
35
  const apiPath = rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql";
51
36
  if (/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(apiPath)) {
@@ -83,10 +68,7 @@ function registerFwGlobals() {
83
68
  }
84
69
  })()
85
70
  };
86
- globalThis.RWJS_DEBUG_ENV = {
87
- RWJS_SRC_ROOT: rwPaths.web.src,
88
- REDWOOD_ENV_EDITOR: JSON.stringify(process.env.REDWOOD_ENV_EDITOR)
89
- };
71
+ globalThis.RWJS_DEBUG_ENV = envVars.RWJS_DEBUG_ENV;
90
72
  }
91
73
  function registerFwShims() {
92
74
  if (!(0, import_project_config.getConfig)().experimental?.rsc?.enabled) {
@@ -1 +1 @@
1
- {"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGjD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAK5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,gBAC1C,UAAU,OAAO,SAAS,KAAG,UAAU,CAkI5D"}
1
+ {"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGjD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAO5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,gBAC1C,UAAU,OAAO,SAAS,KAAG,UAAU,CAkI5D"}
@@ -1,7 +1,10 @@
1
1
  import path from "node:path";
2
2
  import { mergeConfig } from "vite";
3
- import { getConfig, getPaths } from "@cedarjs/project-config";
4
- import { getEnvVarDefinitions } from "./envVarDefinitions.js";
3
+ import {
4
+ getConfig,
5
+ getEnvVarDefinitions,
6
+ getPaths
7
+ } from "@cedarjs/project-config";
5
8
  function getMergedConfig(rwConfig, rwPaths) {
6
9
  return (userConfig, env) => {
7
10
  let apiHost = process.env.REDWOOD_API_HOST;
@@ -1 +1 @@
1
- {"version":3,"file":"registerFwGlobalsAndShims.d.ts","sourceRoot":"","sources":["../../src/lib/registerFwGlobalsAndShims.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,YAGrC,CAAA"}
1
+ {"version":3,"file":"registerFwGlobalsAndShims.d.ts","sourceRoot":"","sources":["../../src/lib/registerFwGlobalsAndShims.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,YAGrC,CAAA"}
@@ -1,18 +1,13 @@
1
- import path from "node:path";
2
- import { getConfig, getPaths } from "@cedarjs/project-config";
1
+ import { getConfig, getEnvVarDefinitions } from "@cedarjs/project-config";
3
2
  const registerFwGlobalsAndShims = () => {
4
3
  registerFwGlobals();
5
4
  registerFwShims();
6
5
  };
7
6
  function registerFwGlobals() {
8
7
  const rwConfig = getConfig();
9
- const rwPaths = getPaths();
8
+ const envVars = getEnvVarDefinitions();
10
9
  globalThis.RWJS_ENV = {
11
- RWJS_API_GRAPHQL_URL: rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql",
12
- RWJS_API_URL: rwConfig.web.apiUrl,
13
- __REDWOOD__APP_TITLE: rwConfig.web.title || path.basename(rwPaths.base),
14
- RWJS_EXP_STREAMING_SSR: rwConfig.experimental.streamingSsr?.enabled,
15
- RWJS_EXP_RSC: rwConfig.experimental?.rsc?.enabled,
10
+ ...envVars.RWJS_ENV,
16
11
  RWJS_EXP_SSR_GRAPHQL_ENDPOINT: (() => {
17
12
  const apiPath = rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql";
18
13
  if (/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(apiPath)) {
@@ -50,10 +45,7 @@ function registerFwGlobals() {
50
45
  }
51
46
  })()
52
47
  };
53
- globalThis.RWJS_DEBUG_ENV = {
54
- RWJS_SRC_ROOT: rwPaths.web.src,
55
- REDWOOD_ENV_EDITOR: JSON.stringify(process.env.REDWOOD_ENV_EDITOR)
56
- };
48
+ globalThis.RWJS_DEBUG_ENV = envVars.RWJS_DEBUG_ENV;
57
49
  }
58
50
  function registerFwShims() {
59
51
  if (!getConfig().experimental?.rsc?.enabled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "1.0.0-canary.12558+2212ab860",
3
+ "version": "1.0.0-canary.12559+795af598e",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,13 +60,13 @@
60
60
  "@babel/generator": "7.27.5",
61
61
  "@babel/parser": "7.27.5",
62
62
  "@babel/traverse": "7.27.4",
63
- "@cedarjs/auth": "1.0.0-canary.12558",
64
- "@cedarjs/babel-config": "1.0.0-canary.12558",
65
- "@cedarjs/cookie-jar": "1.0.0-canary.12558",
66
- "@cedarjs/internal": "1.0.0-canary.12558",
67
- "@cedarjs/project-config": "1.0.0-canary.12558",
68
- "@cedarjs/server-store": "1.0.0-canary.12558",
69
- "@cedarjs/web": "1.0.0-canary.12558",
63
+ "@cedarjs/auth": "1.0.0-canary.12559",
64
+ "@cedarjs/babel-config": "1.0.0-canary.12559",
65
+ "@cedarjs/cookie-jar": "1.0.0-canary.12559",
66
+ "@cedarjs/internal": "1.0.0-canary.12559",
67
+ "@cedarjs/project-config": "1.0.0-canary.12559",
68
+ "@cedarjs/server-store": "1.0.0-canary.12559",
69
+ "@cedarjs/web": "1.0.0-canary.12559",
70
70
  "@swc/core": "1.13.3",
71
71
  "@vitejs/plugin-react": "4.3.4",
72
72
  "@whatwg-node/fetch": "0.9.21",
@@ -110,5 +110,5 @@
110
110
  "typescript": "5.6.2",
111
111
  "vitest": "3.2.4"
112
112
  },
113
- "gitHead": "2212ab8607fadb7ed3122e3b05af3edaf6a7e066"
113
+ "gitHead": "795af598e0aa1fec669a9e9def77f5aa4d57565d"
114
114
  }
@@ -1,87 +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 envVarDefinitions_exports = {};
30
- __export(envVarDefinitions_exports, {
31
- getEnvVarDefinitions: () => getEnvVarDefinitions
32
- });
33
- module.exports = __toCommonJS(envVarDefinitions_exports);
34
- var import_node_path = __toESM(require("node:path"), 1);
35
- var import_project_config = require("@cedarjs/project-config");
36
- function getEnvVarDefinitions() {
37
- const rwConfig = (0, import_project_config.getConfig)();
38
- const rwPaths = (0, import_project_config.getPaths)();
39
- return {
40
- RWJS_ENV: {
41
- RWJS_API_GRAPHQL_URL: rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql",
42
- RWJS_API_URL: rwConfig.web.apiUrl,
43
- __REDWOOD__APP_TITLE: rwConfig.web.title || import_node_path.default.basename(rwPaths.base),
44
- RWJS_EXP_STREAMING_SSR: rwConfig.experimental.streamingSsr?.enabled,
45
- RWJS_EXP_RSC: rwConfig.experimental?.rsc?.enabled
46
- },
47
- RWJS_DEBUG_ENV: {
48
- RWJS_SRC_ROOT: rwPaths.web.src,
49
- REDWOOD_ENV_EDITOR: JSON.stringify(process.env.REDWOOD_ENV_EDITOR)
50
- },
51
- // Vite can automatically expose environment variables, but we
52
- // disable that in `buildFeServer.ts` by setting `envFile: false`
53
- // because we want to use our own logic for loading .env,
54
- // .env.defaults, etc
55
- // The two object spreads below will expose all environment
56
- // variables listed in redwood.toml and all environment variables
57
- // prefixed with REDWOOD_ENV_
58
- ...Object.fromEntries(
59
- rwConfig.web.includeEnvironmentVariables.flatMap((envName) => [
60
- // TODO: Figure out if/why we need to disable eslint here, when we
61
- // didn't have to before, when this code was in index.ts
62
- // Re-enable if possible
63
- // eslint-disable-next-line
64
- [`import.meta.env.${envName}`, JSON.stringify(process.env[envName])],
65
- // TODO: Figure out if/why we need to disable eslint here, when we
66
- // didn't have to before, when this code was in index.ts
67
- // Re-enable if possible
68
- // eslint-disable-next-line
69
- [`process.env.${envName}`, JSON.stringify(process.env[envName])]
70
- ])
71
- ),
72
- ...Object.entries(process.env).reduce(
73
- (acc, [key, value]) => {
74
- if (key.startsWith("REDWOOD_ENV_")) {
75
- acc[`import.meta.env.${key}`] = JSON.stringify(value);
76
- acc[`process.env.${key}`] = JSON.stringify(value);
77
- }
78
- return acc;
79
- },
80
- {}
81
- )
82
- };
83
- }
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- getEnvVarDefinitions
87
- });
@@ -1,14 +0,0 @@
1
- export declare function getEnvVarDefinitions(): {
2
- RWJS_ENV: {
3
- RWJS_API_GRAPHQL_URL: string;
4
- RWJS_API_URL: string;
5
- __REDWOOD__APP_TITLE: string;
6
- RWJS_EXP_STREAMING_SSR: boolean;
7
- RWJS_EXP_RSC: boolean;
8
- };
9
- RWJS_DEBUG_ENV: {
10
- RWJS_SRC_ROOT: string;
11
- REDWOOD_ENV_EDITOR: string;
12
- };
13
- };
14
- //# sourceMappingURL=envVarDefinitions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"envVarDefinitions.d.ts","sourceRoot":"","sources":["../../src/lib/envVarDefinitions.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB;;;;;;;;;;;;EAkDnC"}
@@ -1,53 +0,0 @@
1
- import path from "node:path";
2
- import { getConfig, getPaths } from "@cedarjs/project-config";
3
- function getEnvVarDefinitions() {
4
- const rwConfig = getConfig();
5
- const rwPaths = getPaths();
6
- return {
7
- RWJS_ENV: {
8
- RWJS_API_GRAPHQL_URL: rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql",
9
- RWJS_API_URL: rwConfig.web.apiUrl,
10
- __REDWOOD__APP_TITLE: rwConfig.web.title || path.basename(rwPaths.base),
11
- RWJS_EXP_STREAMING_SSR: rwConfig.experimental.streamingSsr?.enabled,
12
- RWJS_EXP_RSC: rwConfig.experimental?.rsc?.enabled
13
- },
14
- RWJS_DEBUG_ENV: {
15
- RWJS_SRC_ROOT: rwPaths.web.src,
16
- REDWOOD_ENV_EDITOR: JSON.stringify(process.env.REDWOOD_ENV_EDITOR)
17
- },
18
- // Vite can automatically expose environment variables, but we
19
- // disable that in `buildFeServer.ts` by setting `envFile: false`
20
- // because we want to use our own logic for loading .env,
21
- // .env.defaults, etc
22
- // The two object spreads below will expose all environment
23
- // variables listed in redwood.toml and all environment variables
24
- // prefixed with REDWOOD_ENV_
25
- ...Object.fromEntries(
26
- rwConfig.web.includeEnvironmentVariables.flatMap((envName) => [
27
- // TODO: Figure out if/why we need to disable eslint here, when we
28
- // didn't have to before, when this code was in index.ts
29
- // Re-enable if possible
30
- // eslint-disable-next-line
31
- [`import.meta.env.${envName}`, JSON.stringify(process.env[envName])],
32
- // TODO: Figure out if/why we need to disable eslint here, when we
33
- // didn't have to before, when this code was in index.ts
34
- // Re-enable if possible
35
- // eslint-disable-next-line
36
- [`process.env.${envName}`, JSON.stringify(process.env[envName])]
37
- ])
38
- ),
39
- ...Object.entries(process.env).reduce(
40
- (acc, [key, value]) => {
41
- if (key.startsWith("REDWOOD_ENV_")) {
42
- acc[`import.meta.env.${key}`] = JSON.stringify(value);
43
- acc[`process.env.${key}`] = JSON.stringify(value);
44
- }
45
- return acc;
46
- },
47
- {}
48
- )
49
- };
50
- }
51
- export {
52
- getEnvVarDefinitions
53
- };