@eik/core 1.4.1 → 1.4.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,3 +1,17 @@
1
+ ## [1.4.3](https://github.com/eik-lib/core/compare/v1.4.2...v1.4.3) (2024-11-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency @metrics/client to v2.5.4 ([#458](https://github.com/eik-lib/core/issues/458)) ([066fee4](https://github.com/eik-lib/core/commit/066fee4c954206d59618d6b95681f4c747db3c0f))
7
+
8
+ ## [1.4.2](https://github.com/eik-lib/core/compare/v1.4.1...v1.4.2) (2024-08-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * windows support ([#441](https://github.com/eik-lib/core/issues/441)) ([50380a7](https://github.com/eik-lib/core/commit/50380a754036510f0b71c1fddf100e1a09cd48a3))
14
+
1
15
  ## [1.4.1](https://github.com/eik-lib/core/compare/v1.4.0...v1.4.1) (2024-08-15)
2
16
 
3
17
 
@@ -1,5 +1,6 @@
1
1
  import mime from "mime";
2
2
  import path from "node:path";
3
+ import { toUrlPathname } from "../utils/url.js";
3
4
 
4
5
  /**
5
6
  * @typedef {object} AssetOptions
@@ -31,7 +32,7 @@ const Asset = class Asset {
31
32
  this._size = -1;
32
33
 
33
34
  this._integrity = "";
34
- this._pathname = path.join("/", pathname);
35
+ this._pathname = toUrlPathname(path.join("/", pathname));
35
36
  this._version = version;
36
37
  this._name = name;
37
38
  this._org = org;
package/lib/sinks/test.js CHANGED
@@ -4,7 +4,7 @@ import Metrics from "@metrics/client";
4
4
  import Sink from "@eik/sink";
5
5
  import mime from "mime";
6
6
  import path from "node:path";
7
-
7
+ import { toUrlPathname } from "../utils/url.js";
8
8
  import Entry from "./mem-entry.js";
9
9
 
10
10
  const DEFAULT_ROOT_PATH = "/eik";
@@ -41,7 +41,7 @@ export default class SinkTest extends Sink {
41
41
  }
42
42
 
43
43
  set(filePath, payload) {
44
- const pathname = path.join(this._rootPath, filePath);
44
+ const pathname = toUrlPathname(path.join(this._rootPath, filePath));
45
45
  const mimeType = mime.getType(pathname) || "application/octet-stream";
46
46
 
47
47
  let entry;
@@ -56,7 +56,7 @@ export default class SinkTest extends Sink {
56
56
  }
57
57
 
58
58
  get(filePath) {
59
- const pathname = path.join(this._rootPath, filePath);
59
+ const pathname = toUrlPathname(path.join(this._rootPath, filePath));
60
60
  if (this._state.has(pathname)) {
61
61
  const entry = this._state.get(pathname);
62
62
  return entry.payload.join("");
@@ -110,7 +110,7 @@ export default class SinkTest extends Sink {
110
110
  return;
111
111
  }
112
112
 
113
- const pathname = path.join(this._rootPath, filePath);
113
+ const pathname = toUrlPathname(path.join(this._rootPath, filePath));
114
114
 
115
115
  if (pathname.indexOf(this._rootPath) !== 0) {
116
116
  this._counter.inc({ labels: { operation } });
@@ -178,7 +178,7 @@ export default class SinkTest extends Sink {
178
178
  return;
179
179
  }
180
180
 
181
- const pathname = path.join(this._rootPath, filePath);
181
+ const pathname = toUrlPathname(path.join(this._rootPath, filePath));
182
182
 
183
183
  if (pathname.indexOf(this._rootPath) !== 0) {
184
184
  this._counter.inc({ labels: { operation } });
@@ -228,7 +228,7 @@ export default class SinkTest extends Sink {
228
228
  return;
229
229
  }
230
230
 
231
- const pathname = path.join(this._rootPath, filePath);
231
+ const pathname = toUrlPathname(path.join(this._rootPath, filePath));
232
232
 
233
233
  if (pathname.indexOf(this._rootPath) !== 0) {
234
234
  this._counter.inc({ labels: { operation } });
@@ -267,7 +267,7 @@ export default class SinkTest extends Sink {
267
267
  return;
268
268
  }
269
269
 
270
- const pathname = path.join(this._rootPath, filePath);
270
+ const pathname = toUrlPathname(path.join(this._rootPath, filePath));
271
271
 
272
272
  if (pathname.indexOf(this._rootPath) !== 0) {
273
273
  this._counter.inc({ labels: { operation } });
@@ -1,38 +1,31 @@
1
1
  import path from "node:path";
2
2
  import globals from "./globals.js";
3
-
4
- // Build URL pathname to a package log file
3
+ import { toUrlPathname } from "./url.js";
5
4
 
6
5
  const createURIPathToPkgLog = ({ type = "", name = "", version = "" } = {}) =>
7
- path.join(globals.ROOT, type, name, version);
8
-
9
- // Build URL pathname to an asset in a package
6
+ toUrlPathname(path.join(globals.ROOT, type, name, version));
10
7
 
11
8
  const createURIPathToAsset = ({
12
9
  type = "",
13
10
  name = "",
14
11
  version = "",
15
12
  asset = "",
16
- } = {}) => path.join(globals.ROOT, type, name, version, asset);
17
-
18
- // Build URL pathname to an import map
13
+ } = {}) => toUrlPathname(path.join(globals.ROOT, type, name, version, asset));
19
14
 
20
15
  const createURIPathToImportMap = ({ name = "", version = "" } = {}) =>
21
- path.join(globals.ROOT, globals.BASE_IMPORT_MAPS, name, version);
22
-
23
- // Build URL pathname to an alias source
16
+ toUrlPathname(
17
+ path.join(globals.ROOT, globals.BASE_IMPORT_MAPS, name, version),
18
+ );
24
19
 
25
20
  const createURIToAlias = ({ type = "", name = "", alias = "" } = {}) =>
26
- path.join(globals.ROOT, type, name, `v${alias}`);
27
-
28
- // Build URL pathname to an alias target destination
21
+ toUrlPathname(path.join(globals.ROOT, type, name, `v${alias}`));
29
22
 
30
23
  const createURIToTargetOfAlias = ({
31
24
  type = "",
32
25
  name = "",
33
26
  version = "",
34
27
  extra = "",
35
- } = {}) => path.join(globals.ROOT, type, name, version, extra);
28
+ } = {}) => toUrlPathname(path.join(globals.ROOT, type, name, version, extra));
36
29
 
37
30
  export {
38
31
  createURIPathToPkgLog,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Takes a pathname that may have win32 separators and ensures it's ready to be used as a URI
3
+ * @param {string} pathname
4
+ * @returns {string}
5
+ */
6
+ export function toUrlPathname(pathname) {
7
+ return pathname.replace(/\\/g, "/");
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eik/core",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Core server package",
5
5
  "main": "lib/main.js",
6
6
  "types": "./types/main.d.ts",
@@ -25,11 +25,11 @@
25
25
  "author": "",
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "@eik/common": "4.1.0",
28
+ "@eik/common": "4.1.1",
29
29
  "@eik/sink": "1.2.5",
30
30
  "@eik/sink-file-system": "1.0.1",
31
31
  "@eik/sink-memory": "1.1.2",
32
- "@metrics/client": "2.5.3",
32
+ "@metrics/client": "2.5.4",
33
33
  "abslog": "2.4.4",
34
34
  "busboy": "1.6.0",
35
35
  "http-errors": "2.0.0",
@@ -41,19 +41,19 @@
41
41
  "unique-slug": "4.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@eik/eslint-config": "1.0.2",
44
+ "@eik/eslint-config": "1.0.4",
45
45
  "@eik/prettier-config": "1.0.1",
46
46
  "@eik/semantic-release-config": "1.0.0",
47
47
  "@eik/typescript-config": "1.0.0",
48
- "@types/readable-stream": "4.0.15",
49
- "eslint": "9.8.0",
50
- "form-data": "4.0.0",
48
+ "@types/readable-stream": "4.0.18",
49
+ "eslint": "9.13.0",
50
+ "form-data": "4.0.1",
51
51
  "mkdirp": "3.0.1",
52
52
  "node-fetch": "3.3.2",
53
- "npm-run-all": "4.1.5",
53
+ "npm-run-all2": "5.0.2",
54
54
  "prettier": "3.3.3",
55
55
  "rimraf": "6.0.1",
56
- "semantic-release": "24.0.0",
56
+ "semantic-release": "24.1.2",
57
57
  "tap": "18.8.0",
58
58
  "typescript": "5.5.4"
59
59
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Takes a pathname that may have win32 separators and ensures it's ready to be used as a URI
3
+ * @param {string} pathname
4
+ * @returns {string}
5
+ */
6
+ export function toUrlPathname(pathname: string): string;