@eik/core 1.4.0 → 1.4.2
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 +14 -0
- package/lib/classes/asset.js +2 -1
- package/lib/sinks/test.js +7 -7
- package/lib/utils/path-builders-uri.js +8 -15
- package/lib/utils/url.js +8 -0
- package/package.json +3 -3
- package/types/utils/url.d.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.4.2](https://github.com/eik-lib/core/compare/v1.4.1...v1.4.2) (2024-08-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* windows support ([#441](https://github.com/eik-lib/core/issues/441)) ([50380a7](https://github.com/eik-lib/core/commit/50380a754036510f0b71c1fddf100e1a09cd48a3))
|
|
7
|
+
|
|
8
|
+
## [1.4.1](https://github.com/eik-lib/core/compare/v1.4.0...v1.4.1) (2024-08-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @eik/sink-memory to v1.1.2 ([b757e0d](https://github.com/eik-lib/core/commit/b757e0d0b5aa1e602e4baba1585e36a5b4711749))
|
|
14
|
+
|
|
1
15
|
# [1.4.0](https://github.com/eik-lib/core/compare/v1.3.61...v1.4.0) (2024-08-14)
|
|
2
16
|
|
|
3
17
|
|
package/lib/classes/asset.js
CHANGED
|
@@ -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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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,
|
package/lib/utils/url.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eik/core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Core server package",
|
|
5
5
|
"main": "lib/main.js",
|
|
6
6
|
"types": "./types/main.d.ts",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@eik/common": "4.1.
|
|
28
|
+
"@eik/common": "4.1.1",
|
|
29
29
|
"@eik/sink": "1.2.5",
|
|
30
30
|
"@eik/sink-file-system": "1.0.1",
|
|
31
|
-
"@eik/sink-memory": "1.1.
|
|
31
|
+
"@eik/sink-memory": "1.1.2",
|
|
32
32
|
"@metrics/client": "2.5.3",
|
|
33
33
|
"abslog": "2.4.4",
|
|
34
34
|
"busboy": "1.6.0",
|