@altano/html-cdnify 3.0.0 → 3.0.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/dist/CDNTransformer.d.ts +2 -2
- package/dist/CDNTransformer.js +2 -2
- package/dist/HtmlAttributeStreamTransformer.d.ts +1 -1
- package/dist/HtmlAttributeStreamTransformer.js +3 -7
- package/dist/HtmlTransformer.d.ts +1 -4
- package/dist/cdnify.d.ts +2 -3
- package/dist/cdnify.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +30 -24
package/dist/CDNTransformer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as HtmlAttributeStreamTransformer from "./HtmlAttributeStreamTransformer";
|
|
1
|
+
import * as HtmlAttributeStreamTransformer from "./HtmlAttributeStreamTransformer.js";
|
|
2
2
|
export type CDNTransformFunction = (cdnUrl: string, oldUrl: string, bufferPath: string) => string;
|
|
3
3
|
export interface CDNTransformerOptions {
|
|
4
4
|
cdnUrl: string;
|
|
@@ -16,6 +16,6 @@ export declare class CDNTransformer extends HtmlAttributeStreamTransformer.HtmlA
|
|
|
16
16
|
#private;
|
|
17
17
|
cdnOptions: Required<CDNTransformerOptions>;
|
|
18
18
|
constructor(cdnOptions: CDNTransformerOptions);
|
|
19
|
-
static defaultTransformFunction: (newUrlBase: string, oldUrl: string, pathOldUrlIsRelativeTo?: string
|
|
19
|
+
static defaultTransformFunction: (newUrlBase: string, oldUrl: string, pathOldUrlIsRelativeTo?: string) => string;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=CDNTransformer.d.ts.map
|
package/dist/CDNTransformer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unionBy, merge, mergeWith } from "lodash";
|
|
2
|
-
import urlConverter from "./urlConverter";
|
|
3
|
-
import * as HtmlAttributeStreamTransformer from "./HtmlAttributeStreamTransformer";
|
|
2
|
+
import urlConverter from "./urlConverter.js";
|
|
3
|
+
import * as HtmlAttributeStreamTransformer from "./HtmlAttributeStreamTransformer.js";
|
|
4
4
|
class OptionsMerger {
|
|
5
5
|
static isTransformDefinition(a) {
|
|
6
6
|
return a != null && typeof a === "object" && "selector" in a && "attribute" in a && typeof a.selector === "string" && typeof a.selector === "string" && typeof a.attribute === "string";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { groupBy } from "lodash";
|
|
2
|
-
import HtmlTransformer from "./HtmlTransformer";
|
|
2
|
+
import HtmlTransformer from "./HtmlTransformer.js";
|
|
3
3
|
class HtmlAttributeStreamTransformer extends HtmlTransformer {
|
|
4
4
|
constructor(options) {
|
|
5
5
|
super();
|
|
@@ -57,12 +57,8 @@ class HtmlAttributeStreamTransformer extends HtmlTransformer {
|
|
|
57
57
|
return [obj.attribute, obj.attributeParser];
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
|
-
this.condensedTransformOptions = Object.
|
|
61
|
-
(
|
|
62
|
-
const likeTransformOptions = groupedTransformOptions[key];
|
|
63
|
-
if (likeTransformOptions == null || likeTransformOptions[0] == null) {
|
|
64
|
-
throw new Error(`No likeTransformOptions`);
|
|
65
|
-
}
|
|
60
|
+
this.condensedTransformOptions = Object.values(groupedTransformOptions).map(
|
|
61
|
+
(likeTransformOptions) => {
|
|
66
62
|
const attribute = likeTransformOptions[0].attribute;
|
|
67
63
|
const attributeParser = likeTransformOptions[0].attributeParser;
|
|
68
64
|
return {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/// <reference types="./types/trumpet.d.ts" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { type Trumpet } from "@gofunky/trumpet";
|
|
4
|
-
export
|
|
5
|
-
}
|
|
2
|
+
export type TrumpetTransformStream = Trumpet;
|
|
6
3
|
export default class HtmlTransformer {
|
|
7
4
|
private transformStream;
|
|
8
5
|
constructor();
|
package/dist/cdnify.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from "./CDNTransformer";
|
|
1
|
+
import { CDNTransformerOptions } from "./CDNTransformer.js";
|
|
2
|
+
export * from "./CDNTransformer.js";
|
|
4
3
|
export interface CdnifyOptions extends CDNTransformerOptions {
|
|
5
4
|
buffer: string | Buffer;
|
|
6
5
|
}
|
package/dist/cdnify.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CDNTransformer } from "./CDNTransformer";
|
|
2
|
-
export * from "./CDNTransformer";
|
|
1
|
+
import { CDNTransformer } from "./CDNTransformer.js";
|
|
2
|
+
export * from "./CDNTransformer.js";
|
|
3
3
|
import streamifier from "streamifier";
|
|
4
4
|
function cdnify(options) {
|
|
5
5
|
if (typeof options.buffer !== "string") {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./cdnify";
|
|
2
|
-
export * from "./CDNTransformer";
|
|
1
|
+
export * from "./cdnify.js";
|
|
2
|
+
export * from "./CDNTransformer.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./cdnify";
|
|
2
|
-
export * from "./CDNTransformer";
|
|
1
|
+
export * from "./cdnify.js";
|
|
2
|
+
export * from "./CDNTransformer.js";
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/html-cdnify",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"sideEffects": false,
|
|
6
|
-
"exports": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
3
|
+
"version": "3.0.2",
|
|
8
4
|
"description": "Transform the relative URLs in your HTML markup (e.g. scripts, stylesheets, images) to use your CDN URL.",
|
|
9
5
|
"keywords": [
|
|
10
6
|
"cdn",
|
|
11
|
-
"
|
|
7
|
+
"cdnification",
|
|
12
8
|
"cdnify",
|
|
13
|
-
"
|
|
14
|
-
],
|
|
15
|
-
"files": [
|
|
16
|
-
"assets/logo.png",
|
|
17
|
-
"dist/**/*.js",
|
|
18
|
-
"dist/**/*.d.ts"
|
|
9
|
+
"html"
|
|
19
10
|
],
|
|
11
|
+
"homepage": "https://github.com/altano/npm-packages/tree/main/packages/html-cdnify",
|
|
20
12
|
"repository": {
|
|
21
13
|
"type": "git",
|
|
22
14
|
"url": "https://github.com/altano/npm-packages",
|
|
23
15
|
"directory": "packages/html-cdnify"
|
|
24
16
|
},
|
|
25
|
-
"
|
|
17
|
+
"license": "ISC",
|
|
26
18
|
"author": {
|
|
27
19
|
"name": "Alan Norbauer",
|
|
28
20
|
"email": "altano@gmail.com",
|
|
29
21
|
"url": "https://alan.norbauer.com"
|
|
30
22
|
},
|
|
31
|
-
"
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"type": "module",
|
|
25
|
+
"exports": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"assets/logo.png",
|
|
29
|
+
"dist/**/*.js",
|
|
30
|
+
"dist/**/*.d.ts"
|
|
31
|
+
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@gofunky/trumpet": "^3.0.3",
|
|
34
34
|
"glob": "^10.3.10",
|
|
@@ -37,17 +37,22 @@
|
|
|
37
37
|
"streamifier": "^0.1.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@arethetypeswrong/cli": "^0.15.4",
|
|
40
41
|
"@types/glob": "^8.1.0",
|
|
41
42
|
"@types/lodash": "^4.14.202",
|
|
42
|
-
"@types/node": "^20.
|
|
43
|
+
"@types/node": "^20.16.5",
|
|
43
44
|
"@types/stream-to-promise": "^2.2.4",
|
|
44
45
|
"@types/streamifier": "^0.1.2",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
46
|
+
"@vitest/coverage-v8": "^2.1.3",
|
|
47
|
+
"eslint": "^9.13.0",
|
|
48
|
+
"prettier": "^3.3.3",
|
|
49
|
+
"typescript": "^5.6.3",
|
|
50
|
+
"vite": "^5.4.10",
|
|
51
|
+
"vitest": "^2.1.3",
|
|
52
|
+
"@altano/build-config": "0.0.0",
|
|
53
|
+
"@altano/testing": "0.0.0",
|
|
49
54
|
"@altano/tsconfig": "0.0.0",
|
|
50
|
-
"
|
|
55
|
+
"@altano/vitest-plugins": "0.2.0"
|
|
51
56
|
},
|
|
52
57
|
"engines": {
|
|
53
58
|
"node": ">=5.10.1"
|
|
@@ -58,16 +63,17 @@
|
|
|
58
63
|
"scripts": {
|
|
59
64
|
"build": "tsup --config build-config/tsup.config.node.ts",
|
|
60
65
|
"build:types": "tsc --project tsconfig.declarations.json",
|
|
66
|
+
"check:exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
|
|
67
|
+
"check:types:src": "tsc --noEmit",
|
|
68
|
+
"check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
|
|
61
69
|
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
62
70
|
"dev": "pnpm run build --watch",
|
|
63
71
|
"format": "prettier --check src",
|
|
64
72
|
"format:fix": "prettier --write src",
|
|
65
|
-
"lint": "eslint
|
|
73
|
+
"lint": "eslint",
|
|
66
74
|
"lint:fix": "TIMING=1 pnpm lint --fix",
|
|
67
75
|
"lint:timing": "TIMING=1 pnpm lint",
|
|
68
76
|
"test:unit": "vitest --run",
|
|
69
|
-
"test:unit:watch": "vitest"
|
|
70
|
-
"typecheck:src": "tsc --noEmit",
|
|
71
|
-
"typecheck:test": "tsc --noEmit --project ./tests/tsconfig.json"
|
|
77
|
+
"test:unit:watch": "vitest"
|
|
72
78
|
}
|
|
73
79
|
}
|