@granite-js/plugin-env 0.1.1 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @granite-js/plugin-env
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @granite-js/plugin-core@0.1.3
8
+ - @granite-js/utils@0.1.3
9
+
10
+ ## 0.1.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 62cf090: normalize environment variable values to string types
15
+ - @granite-js/plugin-core@0.1.2
16
+ - @granite-js/utils@0.1.2
17
+
3
18
  ## 0.1.1
4
19
 
5
20
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -59,10 +59,7 @@ const generateEnvType = (0, __granite_js_utils.ensureSafetyInvokeSync)(generateE
59
59
  //#endregion
60
60
  //#region src/getRuntimeEnvScript.ts
61
61
  function getRuntimeEnvScript(serializableObject) {
62
- const assignExpressions = Object.entries(serializableObject).map(([key, value]) => {
63
- if (value == null) throw new Error(`${key} is not defined`);
64
- return `global.__granite.meta.env['${key}'] = ${JSON.stringify(value)};`;
65
- });
62
+ const assignExpressions = Object.entries(serializableObject).map(([key, value]) => `global.__granite.meta.env['${key}'] = ${JSON.stringify(String(value))};`);
66
63
  return `
67
64
  (function (global) {
68
65
  global.__granite = global.__granite || {};
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { GranitePluginCore } from "@granite-js/plugin-core";
2
2
 
3
3
  //#region src/types.d.ts
4
4
  interface SerializableObject {
5
- [key: string]: string | number | boolean | SerializableObject;
5
+ [key: string]: string | number | boolean | null | undefined | SerializableObject;
6
6
  }
7
7
 
8
8
  //#endregion
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { GranitePluginCore } from "@granite-js/plugin-core";
2
2
 
3
3
  //#region src/types.d.ts
4
4
  interface SerializableObject {
5
- [key: string]: string | number | boolean | SerializableObject;
5
+ [key: string]: string | number | boolean | null | undefined | SerializableObject;
6
6
  }
7
7
 
8
8
  //#endregion
package/dist/index.js CHANGED
@@ -41,10 +41,7 @@ const generateEnvType = ensureSafetyInvokeSync(generateEnvTypeImpl);
41
41
  //#endregion
42
42
  //#region src/getRuntimeEnvScript.ts
43
43
  function getRuntimeEnvScript(serializableObject) {
44
- const assignExpressions = Object.entries(serializableObject).map(([key, value]) => {
45
- if (value == null) throw new Error(`${key} is not defined`);
46
- return `global.__granite.meta.env['${key}'] = ${JSON.stringify(value)};`;
47
- });
44
+ const assignExpressions = Object.entries(serializableObject).map(([key, value]) => `global.__granite.meta.env['${key}'] = ${JSON.stringify(String(value))};`);
48
45
  return `
49
46
  (function (global) {
50
47
  global.__granite = global.__granite || {};
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@granite-js/plugin-env",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "license": "Apache-2.0",
6
6
  "description": "An env plugin for Granite",
7
7
  "scripts": {
8
8
  "prepack": "yarn build",
9
9
  "typecheck": "tsc --noEmit",
10
- "test": "vitest --run",
10
+ "test": "vitest --run --coverage",
11
11
  "build": "tsdown"
12
12
  },
13
13
  "types": "./dist/index.d.ts",
@@ -32,13 +32,15 @@
32
32
  "@babel/core": "7.23.9",
33
33
  "@babel/types": "7.23.9",
34
34
  "@types/babel__core": "^7.20.5",
35
+ "@types/node": "^22.10.2",
36
+ "@vitest/coverage-v8": "^3.1.3",
35
37
  "tsdown": "^0.11.12",
36
38
  "typescript": "^5.6.3",
37
39
  "vitest": "^3.1.3"
38
40
  },
39
41
  "dependencies": {
40
- "@granite-js/plugin-core": "0.1.1",
41
- "@granite-js/utils": "0.1.1"
42
+ "@granite-js/plugin-core": "0.1.3",
43
+ "@granite-js/utils": "0.1.3"
42
44
  },
43
45
  "sideEffects": false
44
46
  }