@scaleway/configuration-loader 2.7.0 → 2.9.0

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,177 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - chore(engines): remove node engines (#3336)
8
+
9
+ - chore(release): publish
10
+
11
+ - chore: fix a few typos (#47)
12
+
13
+ - chore(deps): update pnpm to v10.33.0 (#2905)
14
+
15
+ - chore(minor-deps): update dependency @scaleway/eslint-config-react to ^3.10.0 (#238)
16
+
17
+ - fix(oxlint): enable 12 tiny unicorn rules as error (#3573)
18
+
19
+ - chore(minor-deps): update dependency @scaleway/eslint-config-react to ^3.14.1 (#378)
20
+
21
+ - chore(patch-deps): update dependency @types/node to v20.19.43 (#3094)
22
+
23
+ - chore(release): publish
24
+
25
+ - chore(packages): upgrade deps (#3157)
26
+
27
+ - feat: update to Node18, remove cross-fetch, and run tests on node+jsdom (#386)
28
+
29
+ - chore(release): publish
30
+
31
+ - chore(deps): update node.js to >=20.19.1 (#2094)
32
+
33
+ - chore(release): publish
34
+
35
+ - chore(release): publish
36
+
37
+ - chore(release): publish
38
+
39
+ - chore(deps): update dependency @types/node to v18.19.130 (#2610)
40
+
41
+ - chore(release): publish
42
+
43
+ - test(vitest): use vitest instead of jest (#1124)
44
+
45
+ - chore(release): publish
46
+
47
+ - chore(release): publish
48
+
49
+ - chore(release): publish
50
+
51
+ - chore(release): publish
52
+
53
+ - feat: publish packages as ESM only (#2624)
54
+
55
+ - chore(release): publish
56
+
57
+ - fix(build): export all types (#1261)
58
+
59
+ - chore(release): publish
60
+
61
+ - feat(configuration-loader): list all configurations at once (#336)
62
+
63
+ - feat(configuration-loader): add async config loading and file permission check (#2860)
64
+
65
+ - chore(release): publish
66
+
67
+ - chore(deps): update node.js to >=20.19.4 (#2280)
68
+
69
+ - chore(deps): update dependency prettier to v3.8.3 (#2907)
70
+
71
+ - chore(client): clean up client usage inside sdk (#1952)
72
+
73
+ - chore: remove linter warnings, and move jsdom to devDep (#1154)
74
+
75
+ - chore(release): publish
76
+
77
+ - chore(deps): update node.js to >=20.20.2 (#2960)
78
+
79
+ - chore(release): publish
80
+
81
+ - fix(release): run by commit and github release cli (#3185)
82
+
83
+ - build: adjust package version (#16)
84
+
85
+ - chore(deps): update node.js to >=20.19.6 (#2604)
86
+
87
+ - chore(release): publish
88
+
89
+ - chore(deps): update dependency vitest to v4 [security] (#2998)
90
+
91
+ - test: check homeDir with empty xdg_config_home (#269)
92
+
93
+ - chore(release): publish
94
+
95
+ - chore(deps): update dependency typescript to ^4.9.3 (#241)
96
+
97
+ - feat: prepare v1 release (#454)
98
+
99
+ - chore(release): publish
100
+
101
+ - chore(release): publish
102
+
103
+ - chore(lerna): remove lerna and use pnpm auto release repo pkg (#3174)
104
+
105
+ - chore(release): publish
106
+
107
+ - chore(release): publish
108
+
109
+ - chore(release): publish
110
+
111
+ - chore(release): publish
112
+
113
+ - chore(release): publish
114
+
115
+ - chore(release): publish
116
+
117
+ - chore(release): publish
118
+
119
+ - chore(release): publish
120
+
121
+ - chore(biome): use biome to format instead of prettier (#1947)
122
+
123
+ - chore(deps): update dependency husky to v9 (#1149)
124
+
125
+ - chore(deps): update dependency @typescript/native-preview to v7.0.0-dev.20260420.1 (#2906)
126
+
127
+ - fix(oxlint): enable 12 fully-fixed rules as error (#3574) (#3575)
128
+
129
+ - chore: migrate from ESLint to Biome for linting and formatting (#2551)
130
+
131
+ - fix(oxlint): enable unicorn/text-encoding-identifier-case as error (#3571)
132
+
133
+ - chore(build): from rollup to vite config (#1255)
134
+
135
+ - chore(release): publish
136
+
137
+ - fix: exclude generated config files from biome formatting (#2661)
138
+
139
+ - chore(typescript): upgrade version (#2916)
140
+
141
+ - chore(release): publish
142
+
143
+ - feat: migrate to GitHub (#1)
144
+
145
+ - chore(release): publish
146
+
147
+ - fix(oxlint): enable eslint/curly as error (#3511)
148
+
149
+ - chore(packages): add licence field, use exports field everywhere (#2147)
150
+
151
+ - feat(sdk): unify tools (#2903)
152
+
153
+ - fix(oxlint): enable unicorn/import-style as error (#3553)
154
+
155
+ - chore: commit generated files for release (#2876)
156
+
157
+ - chore(release): publish
158
+
159
+ - chore: add extension for nodenext (#2265)
160
+
161
+ - feat(sdk-react): add react sdk (#2794)
162
+
163
+ ## 2.8.0
164
+
165
+ ### Minor Changes
166
+
167
+ - fix(oxlint): enable unicorn/import-style as error (#3553)
168
+
169
+ - fix(oxlint): enable 12 fully-fixed rules as error (#3574) (#3575)
170
+
171
+ - fix(oxlint): enable 12 tiny unicorn rules as error (#3573)
172
+
173
+ - fix(oxlint): enable unicorn/text-encoding-identifier-case as error (#3571)
174
+
3
175
  ## 2.7.0
4
176
 
5
177
  ### Minor Changes
@@ -63,7 +63,7 @@ var loadProfileFromConfigurationFile = (params) => {
63
63
  const configs = loadAllProfilesFromConfigurationFile(params);
64
64
  const profileName = params?.profileName ?? "default";
65
65
  const profileMap = configs[profileName];
66
- if (typeof profileMap !== "object") throw new Error(`Could not find the desired profile '${profileName}' in the configuration file.`);
66
+ if (typeof profileMap !== "object") throw new TypeError(`Could not find the desired profile '${profileName}' in the configuration file.`);
67
67
  return profileMap;
68
68
  };
69
69
  /**
@@ -105,7 +105,7 @@ var loadProfileFromConfigurationFileAsync = async (params) => {
105
105
  const configs = await loadAllProfilesFromConfigurationFileAsync(params);
106
106
  const profileName = params?.profileName ?? "default";
107
107
  const profileMap = configs[profileName];
108
- if (typeof profileMap !== "object") throw new Error(`Could not find the desired profile '${profileName}' in the configuration file.`);
108
+ if (typeof profileMap !== "object") throw new TypeError(`Could not find the desired profile '${profileName}' in the configuration file.`);
109
109
  return profileMap;
110
110
  };
111
111
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { EnvironmentKey } from "./env.js";
2
2
  import { homedir } from "node:os";
3
- import * as path from "node:path";
3
+ import path from "node:path";
4
4
  import { env } from "node:process";
5
5
  //#region src/path-resolver.ts
6
6
  /**
@@ -3,9 +3,9 @@ import { promisify } from "node:util";
3
3
  //#region src/yml-loader.ts
4
4
  var readFileAsync = promisify(readFile);
5
5
  var statAsync = promisify(stat);
6
- var STRIP_COMMENT_REGEX = /(^|\s)[;#]/;
7
- var DETECT_SECTION_REGEX = /^\s*([\s\S]+?):\s*$/;
8
- var DETECT_ITEM_REGEX = /^\s*(.+?)\s*:\s*(.+?)\s*$/;
6
+ var STRIP_COMMENT_REGEX = new RegExp("(?<prefix>^|\\s)[;#]", "v");
7
+ var DETECT_SECTION_REGEX = new RegExp("^\\s*(?<section>[\\s\\S]+?):\\s*$", "v");
8
+ var DETECT_ITEM_REGEX = new RegExp("^\\s*(?<key>.+?)\\s*:\\s*(?<value>.+?)\\s*$", "v");
9
9
  /**
10
10
  * Converts YAML to configuration map.
11
11
  *
@@ -19,18 +19,19 @@ var convertYamlToConfiguration = (input) => {
19
19
  let currentSection = "default";
20
20
  const map = {};
21
21
  if (typeof input !== "string") return map;
22
- input.split(/\r?\n/).forEach((rawLine) => {
23
- const line = rawLine.split(STRIP_COMMENT_REGEX)[0];
22
+ input.split(new RegExp("\\r?\\n", "v")).forEach((rawLine) => {
23
+ const [line] = rawLine.split(STRIP_COMMENT_REGEX);
24
24
  const newSection = DETECT_SECTION_REGEX.exec(line);
25
25
  if (newSection) {
26
26
  currentSection = void 0;
27
27
  if (newSection[1] === "profiles") foundProfilesKey = true;
28
28
  else if (foundProfilesKey) [, currentSection] = newSection;
29
- } else if (currentSection) {
29
+ } else if (currentSection !== void 0) {
30
30
  const item = DETECT_ITEM_REGEX.exec(line);
31
31
  if (item) {
32
32
  if (typeof map[currentSection] !== "object") map[currentSection] = {};
33
- [, , map[currentSection][item[1]]] = item;
33
+ const [, key, value] = item;
34
+ map[currentSection][key] = value;
34
35
  }
35
36
  }
36
37
  });
@@ -48,7 +49,7 @@ var convertYamlToConfiguration = (input) => {
48
49
  * @internal
49
50
  */
50
51
  var loadConfigurationFromFile = (filePath) => {
51
- return convertYamlToConfiguration(readFileSync(filePath, "utf-8"));
52
+ return convertYamlToConfiguration(readFileSync(filePath, "utf8"));
52
53
  };
53
54
  /**
54
55
  * Loads configuration from a file (asynchronous).
@@ -65,7 +66,7 @@ var loadConfigurationFromFile = (filePath) => {
65
66
  * @public
66
67
  */
67
68
  var loadConfigurationFromFileAsync = async (filePath) => {
68
- return convertYamlToConfiguration(await readFileAsync(filePath, "utf-8"));
69
+ return convertYamlToConfiguration(await readFileAsync(filePath, "utf8"));
69
70
  };
70
71
  /**
71
72
  * Checks whether a configuration file has secure permissions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/configuration-loader",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "description": "Load configuration via file or environment for NodeJS.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@repo/configs": "^0.1.1",
23
- "@types/node": "26.5.1"
23
+ "@types/node": "26.6.2"
24
24
  },
25
25
  "scripts": {
26
26
  "typecheck": "tsc --noEmit",