@altano/html-cdnify 3.0.2 → 3.0.4
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/dist/CDNTransformer.js
CHANGED
|
@@ -9,7 +9,7 @@ class OptionsMerger {
|
|
|
9
9
|
return Array.isArray(a) && a.length > 0 && OptionsMerger.isTransformDefinition(a[0]);
|
|
10
10
|
}
|
|
11
11
|
static mergeCustomizer = (objValue, srcValue) => {
|
|
12
|
-
if (OptionsMerger.isTransformDefinitions(objValue)
|
|
12
|
+
if (OptionsMerger.isTransformDefinitions(objValue) && OptionsMerger.isTransformDefinitions(srcValue)) {
|
|
13
13
|
const result = unionBy(
|
|
14
14
|
srcValue,
|
|
15
15
|
objValue,
|
|
@@ -55,7 +55,7 @@ class CDNTransformer extends HtmlAttributeStreamTransformer.HtmlAttributeStreamT
|
|
|
55
55
|
cdnOptions
|
|
56
56
|
);
|
|
57
57
|
if (typeof this.cdnOptions.cdnUrl !== "string") {
|
|
58
|
-
throw new Error(`Invalid cdnUrl
|
|
58
|
+
throw new Error(`Invalid cdnUrl specified.`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
#cdnifyAttribute(oldUrl) {
|
|
@@ -7,7 +7,7 @@ export interface HtmlAttributeStreamTransformerOptions {
|
|
|
7
7
|
export interface TransformDefinition {
|
|
8
8
|
selector: string;
|
|
9
9
|
attribute: string;
|
|
10
|
-
attributeParser?: (oldAttribute: string, transformFunction: TransformFunction) => string;
|
|
10
|
+
attributeParser?: undefined | ((oldAttribute: string, transformFunction: TransformFunction) => string);
|
|
11
11
|
}
|
|
12
12
|
export type TransformFunction = (oldAttribute: string) => string;
|
|
13
13
|
export interface AttributeParser {
|
|
@@ -42,10 +42,10 @@ class HtmlAttributeStreamTransformer extends HtmlTransformer {
|
|
|
42
42
|
option.attributeParser = HtmlAttributeStreamTransformer.attributeParsers["default"];
|
|
43
43
|
}
|
|
44
44
|
if (typeof option.selector !== "string") {
|
|
45
|
-
throw new Error(`Invalid selector
|
|
45
|
+
throw new Error(`Invalid selector specified.`);
|
|
46
46
|
}
|
|
47
47
|
if (typeof option.attribute !== "string") {
|
|
48
|
-
throw new Error(`Invalid attribute
|
|
48
|
+
throw new Error(`Invalid attribute specified.`);
|
|
49
49
|
}
|
|
50
50
|
if (!(option.attributeParser instanceof Function)) {
|
|
51
51
|
throw new Error("Invalid attributeParser specified.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/html-cdnify",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Transform the relative URLs in your HTML markup (e.g. scripts, stylesheets, images) to use your CDN URL.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cdn",
|
|
@@ -31,28 +31,27 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@gofunky/trumpet": "^3.0.3",
|
|
34
|
-
"glob": "^10.3.10",
|
|
35
34
|
"lodash": "^4.17.21",
|
|
36
35
|
"stream-to-promise": "^3.0.0",
|
|
37
36
|
"streamifier": "^0.1.1"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
39
|
"@arethetypeswrong/cli": "^0.15.4",
|
|
41
|
-
"@types/glob": "^8.1.0",
|
|
42
40
|
"@types/lodash": "^4.14.202",
|
|
43
|
-
"@types/node": "^
|
|
41
|
+
"@types/node": "^22.13.10",
|
|
44
42
|
"@types/stream-to-promise": "^2.2.4",
|
|
45
43
|
"@types/streamifier": "^0.1.2",
|
|
46
|
-
"@vitest/coverage-v8": "^
|
|
47
|
-
"
|
|
44
|
+
"@vitest/coverage-v8": "^3.0.9",
|
|
45
|
+
"depcheck": "^1.4.7",
|
|
46
|
+
"eslint": "^9.22.0",
|
|
48
47
|
"prettier": "^3.3.3",
|
|
49
|
-
"typescript": "^5.
|
|
50
|
-
"vite": "^
|
|
51
|
-
"vitest": "^
|
|
48
|
+
"typescript": "^5.8.2",
|
|
49
|
+
"vite": "^6.2.3",
|
|
50
|
+
"vitest": "^3.0.9",
|
|
52
51
|
"@altano/build-config": "0.0.0",
|
|
53
52
|
"@altano/testing": "0.0.0",
|
|
54
53
|
"@altano/tsconfig": "0.0.0",
|
|
55
|
-
"@altano/vitest-plugins": "0.
|
|
54
|
+
"@altano/vitest-plugins": "1.0.0"
|
|
56
55
|
},
|
|
57
56
|
"engines": {
|
|
58
57
|
"node": ">=5.10.1"
|
|
@@ -66,6 +65,7 @@
|
|
|
66
65
|
"check:exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
|
|
67
66
|
"check:types:src": "tsc --noEmit",
|
|
68
67
|
"check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
|
|
68
|
+
"check:unused-dependencies": "depcheck",
|
|
69
69
|
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
70
70
|
"dev": "pnpm run build --watch",
|
|
71
71
|
"format": "prettier --check src",
|