@eik/node-client 2.0.25 → 2.0.27

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,3 +1,17 @@
1
+ ## [2.0.27](https://github.com/eik-lib/node-client/compare/v2.0.26...v2.0.27) (2026-05-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Replace Tap with node.js test runner ([#278](https://github.com/eik-lib/node-client/issues/278)) ([25b83ff](https://github.com/eik-lib/node-client/commit/25b83ffda7c1430c46e44967ffe9124daf4f78e4))
7
+
8
+ ## [2.0.26](https://github.com/eik-lib/node-client/compare/v2.0.25...v2.0.26) (2026-05-29)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Bump dependencies ([#273](https://github.com/eik-lib/node-client/issues/273)) ([de93c5e](https://github.com/eik-lib/node-client/commit/de93c5e3cbe9614aa10a67ed21f629ec35dbb17a))
14
+
1
15
  ## [2.0.25](https://github.com/eik-lib/node-client/compare/v2.0.24...v2.0.25) (2026-05-25)
2
16
 
3
17
 
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var common = require('@eik/common');
4
- var path = require('path');
4
+ var node_path = require('node:path');
5
5
 
6
6
  /**
7
7
  * @typedef {object} AssetOptions
@@ -134,10 +134,12 @@ const trimSlash = (value = "") => {
134
134
  class Eik {
135
135
  #development;
136
136
  #loadMaps;
137
- #config;
137
+ /** @type {import('@eik/common').EikConfig | null} */
138
+ #config = null;
138
139
  #path;
139
140
  #base;
140
- #maps;
141
+ /** @type {ImportMap[]} */
142
+ #maps = [];
141
143
 
142
144
  /**
143
145
  * @param {Options} options
@@ -150,10 +152,8 @@ class Eik {
150
152
  } = {}) {
151
153
  this.#development = development;
152
154
  this.#loadMaps = loadMaps;
153
- this.#config = {};
154
155
  this.#path = path;
155
156
  this.#base = trimSlash(base);
156
- this.#maps = [];
157
157
  }
158
158
 
159
159
  /**
@@ -165,7 +165,7 @@ class Eik {
165
165
  */
166
166
  async load() {
167
167
  this.#config = common.helpers.getDefaults(this.#path);
168
- if (this.#loadMaps) {
168
+ if (this.#loadMaps && this.#config) {
169
169
  this.#maps = await common.helpers.fetchImportMaps(this.#config.map);
170
170
  }
171
171
  }
@@ -175,7 +175,7 @@ class Eik {
175
175
  * @throws if read before calling {@link load}
176
176
  */
177
177
  get name() {
178
- if (this.#config.name) return this.#config.name;
178
+ if (this.#config && this.#config.name) return this.#config.name;
179
179
  throw new Error("Eik config was not loaded before calling .name");
180
180
  }
181
181
 
@@ -184,7 +184,7 @@ class Eik {
184
184
  * @throws if read before calling {@link load}
185
185
  */
186
186
  get version() {
187
- if (this.#config.version) return this.#config.version;
187
+ if (this.#config && this.#config.version) return this.#config.version;
188
188
  throw new Error("Eik config was not loaded before calling .version");
189
189
  }
190
190
 
@@ -193,8 +193,9 @@ class Eik {
193
193
  * @throws if read before calling {@link load}
194
194
  */
195
195
  get type() {
196
- if (this.#config.type && this.#config.type === "package") return "pkg";
197
- if (this.#config.type) return this.#config.type;
196
+ if (this.#config && this.#config.type && this.#config.type === "package")
197
+ return "pkg";
198
+ if (this.#config && this.#config.type) return this.#config.type;
198
199
  throw new Error("Eik config was not loaded before calling .type");
199
200
  }
200
201
 
@@ -203,7 +204,7 @@ class Eik {
203
204
  * @throws if read before calling {@link load}
204
205
  */
205
206
  get server() {
206
- if (this.#config.server) return this.#config.server;
207
+ if (this.#config && this.#config.server) return this.#config.server;
207
208
  throw new Error("Eik config was not loaded before calling .server");
208
209
  }
209
210
 
@@ -212,8 +213,13 @@ class Eik {
212
213
  * @throws if read before calling {@link load}
213
214
  */
214
215
  get pathname() {
215
- if (this.#config.type && this.#config.name && this.#config.version)
216
- return path.join(
216
+ if (
217
+ this.#config &&
218
+ this.#config.type &&
219
+ this.#config.name &&
220
+ this.#config.version
221
+ )
222
+ return node_path.join(
217
223
  "/",
218
224
  common.helpers.typeSlug(this.type),
219
225
  this.name,
@@ -310,7 +316,8 @@ class Eik {
310
316
  * ```
311
317
  */
312
318
  maps() {
313
- if (this.#config.version && this.#loadMaps) return this.#maps;
319
+ if (this.#config && this.#config.version && this.#loadMaps)
320
+ return this.#maps;
314
321
  throw new Error(
315
322
  'Eik config was not loaded or "loadMaps" is "false" when calling .maps()',
316
323
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eik/node-client",
3
- "version": "2.0.25",
3
+ "version": "2.0.27",
4
4
  "description": "Utilities for working with assets and import maps on an Eik server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -20,10 +20,10 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "build": "rollup -c",
23
- "clean": "rimraf .tap dist node_modules types",
23
+ "clean": "node --input-type=module --eval \"import{rmSync}from'node:fs';['.tap','dist','node_modules','types'].forEach(p=>rmSync(p,{recursive:true,force:true}))\"",
24
24
  "lint": "eslint .",
25
25
  "lint:fix": "eslint --fix .",
26
- "test": "tap --disable-coverage --allow-empty-coverage",
26
+ "test": "node --test 'test/*.test.js'",
27
27
  "types": "run-s types:module types:test",
28
28
  "types:module": "tsc",
29
29
  "types:test": "tsc --project tsconfig.test.json",
@@ -43,22 +43,20 @@
43
43
  },
44
44
  "homepage": "https://github.com/eik-lib/node-client#readme",
45
45
  "dependencies": {
46
- "@eik/common": "5.1.27",
46
+ "@eik/common": "5.1.29",
47
47
  "abslog": "2.4.4"
48
48
  },
49
49
  "devDependencies": {
50
- "@eik/eslint-config": "2.0.2",
51
- "@eik/prettier-config": "1.0.1",
52
- "@eik/semantic-release-config": "1.0.15",
53
- "@eik/typescript-config": "1.0.1",
54
- "@types/node": "24.10.1",
55
- "eslint": "9.39.4",
56
- "npm-run-all2": "8.0.4",
57
- "prettier": "3.7.4",
58
- "rimraf": "6.1.2",
59
- "rollup": "4.59.0",
60
- "semantic-release": "25.0.2",
61
- "tap": "21.5.0",
62
- "typescript": "5.9.3"
50
+ "@eik/eslint-config": "2.0.7",
51
+ "@eik/prettier-config": "1.0.2",
52
+ "@eik/semantic-release-config": "1.0.17",
53
+ "@eik/typescript-config": "1.0.2",
54
+ "@types/node": "25.9.1",
55
+ "eslint": "10.4.0",
56
+ "npm-run-all2": "9.0.1",
57
+ "prettier": "3.8.3",
58
+ "rollup": "4.60.4",
59
+ "semantic-release": "25.0.3",
60
+ "typescript": "6.0.3"
63
61
  }
64
62
  }
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { helpers } from "@eik/common";
2
- import { join } from "path";
2
+ import { join } from "node:path";
3
3
  import { Asset } from "./asset.js";
4
4
 
5
5
  const trimSlash = (value = "") => {
@@ -82,10 +82,12 @@ const trimSlash = (value = "") => {
82
82
  export default class Eik {
83
83
  #development;
84
84
  #loadMaps;
85
- #config;
85
+ /** @type {import('@eik/common').EikConfig | null} */
86
+ #config = null;
86
87
  #path;
87
88
  #base;
88
- #maps;
89
+ /** @type {ImportMap[]} */
90
+ #maps = [];
89
91
 
90
92
  /**
91
93
  * @param {Options} options
@@ -98,10 +100,8 @@ export default class Eik {
98
100
  } = {}) {
99
101
  this.#development = development;
100
102
  this.#loadMaps = loadMaps;
101
- this.#config = {};
102
103
  this.#path = path;
103
104
  this.#base = trimSlash(base);
104
- this.#maps = [];
105
105
  }
106
106
 
107
107
  /**
@@ -113,7 +113,7 @@ export default class Eik {
113
113
  */
114
114
  async load() {
115
115
  this.#config = helpers.getDefaults(this.#path);
116
- if (this.#loadMaps) {
116
+ if (this.#loadMaps && this.#config) {
117
117
  this.#maps = await helpers.fetchImportMaps(this.#config.map);
118
118
  }
119
119
  }
@@ -123,7 +123,7 @@ export default class Eik {
123
123
  * @throws if read before calling {@link load}
124
124
  */
125
125
  get name() {
126
- if (this.#config.name) return this.#config.name;
126
+ if (this.#config && this.#config.name) return this.#config.name;
127
127
  throw new Error("Eik config was not loaded before calling .name");
128
128
  }
129
129
 
@@ -132,7 +132,7 @@ export default class Eik {
132
132
  * @throws if read before calling {@link load}
133
133
  */
134
134
  get version() {
135
- if (this.#config.version) return this.#config.version;
135
+ if (this.#config && this.#config.version) return this.#config.version;
136
136
  throw new Error("Eik config was not loaded before calling .version");
137
137
  }
138
138
 
@@ -141,8 +141,9 @@ export default class Eik {
141
141
  * @throws if read before calling {@link load}
142
142
  */
143
143
  get type() {
144
- if (this.#config.type && this.#config.type === "package") return "pkg";
145
- if (this.#config.type) return this.#config.type;
144
+ if (this.#config && this.#config.type && this.#config.type === "package")
145
+ return "pkg";
146
+ if (this.#config && this.#config.type) return this.#config.type;
146
147
  throw new Error("Eik config was not loaded before calling .type");
147
148
  }
148
149
 
@@ -151,7 +152,7 @@ export default class Eik {
151
152
  * @throws if read before calling {@link load}
152
153
  */
153
154
  get server() {
154
- if (this.#config.server) return this.#config.server;
155
+ if (this.#config && this.#config.server) return this.#config.server;
155
156
  throw new Error("Eik config was not loaded before calling .server");
156
157
  }
157
158
 
@@ -160,7 +161,12 @@ export default class Eik {
160
161
  * @throws if read before calling {@link load}
161
162
  */
162
163
  get pathname() {
163
- if (this.#config.type && this.#config.name && this.#config.version)
164
+ if (
165
+ this.#config &&
166
+ this.#config.type &&
167
+ this.#config.name &&
168
+ this.#config.version
169
+ )
164
170
  return join(
165
171
  "/",
166
172
  helpers.typeSlug(this.type),
@@ -258,7 +264,8 @@ export default class Eik {
258
264
  * ```
259
265
  */
260
266
  maps() {
261
- if (this.#config.version && this.#loadMaps) return this.#maps;
267
+ if (this.#config && this.#config.version && this.#loadMaps)
268
+ return this.#maps;
262
269
  throw new Error(
263
270
  'Eik config was not loaded or "loadMaps" is "false" when calling .maps()',
264
271
  );
package/types/asset.d.ts CHANGED
@@ -43,5 +43,5 @@ export class Asset {
43
43
  value: string;
44
44
  }
45
45
  export type AssetOptions = {
46
- value?: string;
46
+ value?: string | undefined;
47
47
  };
package/types/index.d.ts CHANGED
@@ -85,22 +85,22 @@ export default class Eik {
85
85
  * The `"name"` field from the Eik config
86
86
  * @throws if read before calling {@link load}
87
87
  */
88
- get name(): any;
88
+ get name(): string;
89
89
  /**
90
90
  * The `"version"` field from the Eik config
91
91
  * @throws if read before calling {@link load}
92
92
  */
93
- get version(): any;
93
+ get version(): string;
94
94
  /**
95
95
  * The `"type"` field from the Eik config mapped to its URL equivalent (eg. "package" is "pkg").
96
96
  * @throws if read before calling {@link load}
97
97
  */
98
- get type(): any;
98
+ get type(): "pkg" | "package" | "npm" | "map" | "image";
99
99
  /**
100
100
  * The `"server"` field from the Eik config
101
101
  * @throws if read before calling {@link load}
102
102
  */
103
- get server(): any;
103
+ get server(): string;
104
104
  /**
105
105
  * The pathname to the base on Eik (ex. /pkg/my-app/1.0.0/)
106
106
  * @throws if read before calling {@link load}
@@ -208,10 +208,10 @@ export default class Eik {
208
208
  #private;
209
209
  }
210
210
  export type Options = {
211
- base?: string;
212
- development?: boolean;
213
- loadMaps?: boolean;
214
- path?: string;
211
+ base?: string | undefined;
212
+ development?: boolean | undefined;
213
+ loadMaps?: boolean | undefined;
214
+ path?: string | undefined;
215
215
  };
216
216
  export type ImportMap = {
217
217
  imports: Record<string, string>;