@squide/env-vars 1.4.4 → 1.4.6
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
|
# @squide/env-vars
|
|
2
2
|
|
|
3
|
+
## 1.4.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#337](https://github.com/workleap/wl-squide/pull/337) [`04600f0`](https://github.com/workleap/wl-squide/commit/04600f08ba724291bfb8102ebdd2d977d8a69f45) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Environment variables can now be provided from the plugin constructor.
|
|
8
|
+
|
|
9
|
+
## 1.4.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#332](https://github.com/workleap/wl-squide/pull/332) [`eb933a7`](https://github.com/workleap/wl-squide/commit/eb933a72514ff3e01f5d3dafa17556e1a07471f6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Bumpbed dependencies
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`eb933a7`](https://github.com/workleap/wl-squide/commit/eb933a72514ff3e01f5d3dafa17556e1a07471f6)]:
|
|
16
|
+
- @squide/core@6.1.3
|
|
17
|
+
|
|
3
18
|
## 1.4.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Plugin, type Runtime } from "@squide/core";
|
|
2
2
|
import { type EnvironmentVariables, type EnvironmentVariablesRegistryKey, type EnvironmentVariablesRegistryValue } from "./EnvironmentVariablesRegistry.ts";
|
|
3
3
|
export declare const EnvironmentVariablesPluginName = "env-vars-plugin";
|
|
4
|
+
export interface EnvironmentVariablesPluginOptions {
|
|
5
|
+
environmentVariables?: Partial<EnvironmentVariables>;
|
|
6
|
+
}
|
|
4
7
|
export declare class EnvironmentVariablesPlugin extends Plugin {
|
|
5
8
|
#private;
|
|
6
|
-
constructor(runtime: Runtime);
|
|
9
|
+
constructor(runtime: Runtime, options?: EnvironmentVariablesPluginOptions);
|
|
7
10
|
registerVariable(key: EnvironmentVariablesRegistryKey, value: EnvironmentVariablesRegistryValue): void;
|
|
8
11
|
registerVariables(variables: Partial<EnvironmentVariables>): void;
|
|
9
12
|
getVariable(key: EnvironmentVariablesRegistryKey): never;
|
|
@@ -11,8 +11,12 @@ import { EnvironmentVariablesRegistry } from "./EnvironmentVariablesRegistry.js"
|
|
|
11
11
|
const EnvironmentVariablesPluginName = "env-vars-plugin";
|
|
12
12
|
class EnvironmentVariablesPlugin extends Plugin {
|
|
13
13
|
#environmentVariablesRegistry = new EnvironmentVariablesRegistry();
|
|
14
|
-
constructor(runtime){
|
|
14
|
+
constructor(runtime, options = {}){
|
|
15
15
|
super(EnvironmentVariablesPluginName, runtime);
|
|
16
|
+
const { environmentVariables } = options;
|
|
17
|
+
if (environmentVariables) {
|
|
18
|
+
this.#environmentVariablesRegistry.addVariables(environmentVariables);
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
registerVariable(key, value) {
|
|
18
22
|
this.#environmentVariablesRegistry.add(key, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentVariablesPlugin.js","sources":["webpack://@squide/env-vars/./src/EnvironmentVariablesPlugin.ts"],"sourcesContent":["import { isNil, Plugin, type Runtime } from \"@squide/core\";\nimport { type EnvironmentVariables, EnvironmentVariablesRegistry, type EnvironmentVariablesRegistryKey, type EnvironmentVariablesRegistryValue } from \"./EnvironmentVariablesRegistry.ts\";\n\nexport const EnvironmentVariablesPluginName = \"env-vars-plugin\";\n\nexport class EnvironmentVariablesPlugin extends Plugin {\n readonly #environmentVariablesRegistry = new EnvironmentVariablesRegistry();\n\n constructor(runtime: Runtime) {\n super(EnvironmentVariablesPluginName, runtime);\n }\n\n registerVariable(key: EnvironmentVariablesRegistryKey, value: EnvironmentVariablesRegistryValue) {\n this.#environmentVariablesRegistry.add(key, value);\n\n this._runtime.logger.debug(`[squide] An environment variable for key \"${key}\" has been registered with the value \"${value}\".`);\n }\n\n registerVariables(variables: Partial<EnvironmentVariables>) {\n this.#environmentVariablesRegistry.addVariables(variables);\n\n this._runtime.logger\n .withText(\"[squide] The following environment variables has been registered:\")\n .withObject(variables)\n .debug();\n }\n\n getVariable(key: EnvironmentVariablesRegistryKey) {\n return this.#environmentVariablesRegistry.getVariable(key);\n }\n\n getVariables() {\n return this.#environmentVariablesRegistry.getVariables();\n }\n}\n\nexport function getEnvironmentVariablesPlugin(runtime: Runtime) {\n const plugin = runtime.getPlugin(EnvironmentVariablesPluginName);\n\n if (isNil(plugin)) {\n throw new Error(\"[squide] The getEnvironmentVariablesPlugin function is called but no EnvironmentVariablesPlugin instance has been registered with the runtime.\");\n }\n\n return plugin as EnvironmentVariablesPlugin;\n}\n"],"names":["isNil","Plugin","EnvironmentVariablesRegistry","EnvironmentVariablesPluginName","EnvironmentVariablesPlugin","runtime","key","value","variables","getEnvironmentVariablesPlugin","plugin","Error"],"mappings":";;;;;;;;AAA2D;AAC+H;AAEnL,MAAMG,iCAAiC,kBAAkB;
|
|
1
|
+
{"version":3,"file":"EnvironmentVariablesPlugin.js","sources":["webpack://@squide/env-vars/./src/EnvironmentVariablesPlugin.ts"],"sourcesContent":["import { isNil, Plugin, type Runtime } from \"@squide/core\";\nimport { type EnvironmentVariables, EnvironmentVariablesRegistry, type EnvironmentVariablesRegistryKey, type EnvironmentVariablesRegistryValue } from \"./EnvironmentVariablesRegistry.ts\";\n\nexport const EnvironmentVariablesPluginName = \"env-vars-plugin\";\n\nexport interface EnvironmentVariablesPluginOptions {\n environmentVariables?: Partial<EnvironmentVariables>;\n}\n\nexport class EnvironmentVariablesPlugin extends Plugin {\n readonly #environmentVariablesRegistry = new EnvironmentVariablesRegistry();\n\n constructor(runtime: Runtime, options: EnvironmentVariablesPluginOptions = {}) {\n super(EnvironmentVariablesPluginName, runtime);\n\n const {\n environmentVariables\n } = options;\n\n if (environmentVariables) {\n this.#environmentVariablesRegistry.addVariables(environmentVariables);\n }\n }\n\n registerVariable(key: EnvironmentVariablesRegistryKey, value: EnvironmentVariablesRegistryValue) {\n this.#environmentVariablesRegistry.add(key, value);\n\n this._runtime.logger.debug(`[squide] An environment variable for key \"${key}\" has been registered with the value \"${value}\".`);\n }\n\n registerVariables(variables: Partial<EnvironmentVariables>) {\n this.#environmentVariablesRegistry.addVariables(variables);\n\n this._runtime.logger\n .withText(\"[squide] The following environment variables has been registered:\")\n .withObject(variables)\n .debug();\n }\n\n getVariable(key: EnvironmentVariablesRegistryKey) {\n return this.#environmentVariablesRegistry.getVariable(key);\n }\n\n getVariables() {\n return this.#environmentVariablesRegistry.getVariables();\n }\n}\n\nexport function getEnvironmentVariablesPlugin(runtime: Runtime) {\n const plugin = runtime.getPlugin(EnvironmentVariablesPluginName);\n\n if (isNil(plugin)) {\n throw new Error(\"[squide] The getEnvironmentVariablesPlugin function is called but no EnvironmentVariablesPlugin instance has been registered with the runtime.\");\n }\n\n return plugin as EnvironmentVariablesPlugin;\n}\n"],"names":["isNil","Plugin","EnvironmentVariablesRegistry","EnvironmentVariablesPluginName","EnvironmentVariablesPlugin","runtime","options","environmentVariables","key","value","variables","getEnvironmentVariablesPlugin","plugin","Error"],"mappings":";;;;;;;;AAA2D;AAC+H;AAEnL,MAAMG,iCAAiC,kBAAkB;AAMzD,MAAMC,mCAAmCH,MAAMA;IACzC,6BAA6B,GAAG,IAAIC,4BAA4BA,GAAG;IAE5E,YAAYG,OAAgB,EAAEC,UAA6C,CAAC,CAAC,CAAE;QAC3E,KAAK,CAACH,gCAAgCE;QAEtC,MAAM,EACFE,oBAAoB,EACvB,GAAGD;QAEJ,IAAIC,sBAAsB;YACtB,IAAI,CAAC,6BAA6B,CAAC,YAAY,CAACA;QACpD;IACJ;IAEA,iBAAiBC,GAAoC,EAAEC,KAAwC,EAAE;QAC7F,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAACD,KAAKC;QAE5C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,0CAA0C,EAAED,IAAI,sCAAsC,EAAEC,MAAM,EAAE,CAAC;IACjI;IAEA,kBAAkBC,SAAwC,EAAE;QACxD,IAAI,CAAC,6BAA6B,CAAC,YAAY,CAACA;QAEhD,IAAI,CAAC,QAAQ,CAAC,MAAM,CACf,QAAQ,CAAC,qEACT,UAAU,CAACA,WACX,KAAK;IACd;IAEA,YAAYF,GAAoC,EAAE;QAC9C,OAAO,IAAI,CAAC,6BAA6B,CAAC,WAAW,CAACA;IAC1D;IAEA,eAAe;QACX,OAAO,IAAI,CAAC,6BAA6B,CAAC,YAAY;IAC1D;AACJ;AAEO,SAASG,8BAA8BN,OAAgB;IAC1D,MAAMO,SAASP,QAAQ,SAAS,CAACF;IAEjC,IAAIH,KAAKA,CAACY,SAAS;QACf,MAAM,IAAIC,MAAM;IACpB;IAEA,OAAOD;AACX"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/env-vars",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.6",
|
|
5
5
|
"description": "Add support for environment variables to @squide application shell.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -24,37 +24,36 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"src",
|
|
26
26
|
"dist",
|
|
27
|
-
"CHANGELOG.md"
|
|
28
|
-
"README.md"
|
|
27
|
+
"CHANGELOG.md"
|
|
29
28
|
],
|
|
30
29
|
"peerDependencies": {
|
|
31
30
|
"react": "^18.0.0 || ^19.0.0"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
33
|
+
"@workleap/logging": "^1.3.1",
|
|
34
|
+
"memoize": "^10.2.0",
|
|
35
|
+
"@squide/core": "6.1.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
38
|
+
"@eslint/js": "9.38.0",
|
|
39
|
+
"@rsbuild/core": "1.5.17",
|
|
40
|
+
"@rslib/core": "0.16.1",
|
|
40
41
|
"@types/react": "19.2.2",
|
|
41
|
-
"@typescript-eslint/parser": "8.46.
|
|
42
|
-
"@vitejs/plugin-react": "5.0
|
|
43
|
-
"@workleap/eslint-
|
|
44
|
-
"@workleap/rslib-configs": "1.1.
|
|
45
|
-
"@workleap/typescript-configs": "3.0.
|
|
46
|
-
"eslint": "
|
|
47
|
-
"happy-dom": "
|
|
42
|
+
"@typescript-eslint/parser": "8.46.2",
|
|
43
|
+
"@vitejs/plugin-react": "5.1.0",
|
|
44
|
+
"@workleap/eslint-configs": "1.0.1",
|
|
45
|
+
"@workleap/rslib-configs": "1.1.3",
|
|
46
|
+
"@workleap/typescript-configs": "3.0.7",
|
|
47
|
+
"eslint": "9.38.0",
|
|
48
|
+
"happy-dom": "20.0.8",
|
|
48
49
|
"typescript": "5.9.3",
|
|
49
|
-
"
|
|
50
|
+
"typescript-eslint": "8.46.2",
|
|
51
|
+
"vitest": "4.0.4"
|
|
50
52
|
},
|
|
51
53
|
"sideEffects": false,
|
|
52
|
-
"engines": {
|
|
53
|
-
"node": ">=21.1.0"
|
|
54
|
-
},
|
|
55
54
|
"scripts": {
|
|
56
55
|
"build": "rslib build --config ./rslib.build.ts",
|
|
57
|
-
"eslint": "eslint . --max-warnings
|
|
56
|
+
"eslint": "eslint . --max-warnings=0 --cache --cache-location node_modules/.cache/eslint",
|
|
58
57
|
"typecheck": "tsc",
|
|
59
58
|
"test": "vitest --config vitest.config.ts --no-watch"
|
|
60
59
|
}
|
|
@@ -3,11 +3,23 @@ import { type EnvironmentVariables, EnvironmentVariablesRegistry, type Environme
|
|
|
3
3
|
|
|
4
4
|
export const EnvironmentVariablesPluginName = "env-vars-plugin";
|
|
5
5
|
|
|
6
|
+
export interface EnvironmentVariablesPluginOptions {
|
|
7
|
+
environmentVariables?: Partial<EnvironmentVariables>;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
export class EnvironmentVariablesPlugin extends Plugin {
|
|
7
11
|
readonly #environmentVariablesRegistry = new EnvironmentVariablesRegistry();
|
|
8
12
|
|
|
9
|
-
constructor(runtime: Runtime) {
|
|
13
|
+
constructor(runtime: Runtime, options: EnvironmentVariablesPluginOptions = {}) {
|
|
10
14
|
super(EnvironmentVariablesPluginName, runtime);
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
environmentVariables
|
|
18
|
+
} = options;
|
|
19
|
+
|
|
20
|
+
if (environmentVariables) {
|
|
21
|
+
this.#environmentVariablesRegistry.addVariables(environmentVariables);
|
|
22
|
+
}
|
|
11
23
|
}
|
|
12
24
|
|
|
13
25
|
registerVariable(key: EnvironmentVariablesRegistryKey, value: EnvironmentVariablesRegistryValue) {
|