@altano/html-cdnify 3.0.1 → 3.0.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.
@@ -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 | undefined) => string;
19
+ static defaultTransformFunction: (newUrlBase: string, oldUrl: string, pathOldUrlIsRelativeTo?: string) => string;
20
20
  }
21
21
  //# sourceMappingURL=CDNTransformer.d.ts.map
@@ -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) || OptionsMerger.isTransformDefinitions(srcValue)) {
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 "${this.cdnOptions.cdnUrl}" specified.`);
58
+ throw new Error(`Invalid cdnUrl specified.`);
59
59
  }
60
60
  }
61
61
  #cdnifyAttribute(oldUrl) {
@@ -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 "${option.selector}" specified.`);
45
+ throw new Error(`Invalid selector specified.`);
46
46
  }
47
47
  if (typeof option.attribute !== "string") {
48
- throw new Error(`Invalid attribute "${option.attribute}" specified.`);
48
+ throw new Error(`Invalid attribute specified.`);
49
49
  }
50
50
  if (!(option.attributeParser instanceof Function)) {
51
51
  throw new Error("Invalid attributeParser specified.");
@@ -57,12 +57,8 @@ class HtmlAttributeStreamTransformer extends HtmlTransformer {
57
57
  return [obj.attribute, obj.attributeParser];
58
58
  }
59
59
  );
60
- this.condensedTransformOptions = Object.keys(groupedTransformOptions).map(
61
- (key) => {
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" resolution-mode="require"/>
3
1
  import { type Trumpet } from "@gofunky/trumpet";
4
- export interface TrumpetTransformStream extends Trumpet {
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,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { CDNTransformerOptions } from "./CDNTransformer.js";
3
2
  export * from "./CDNTransformer.js";
4
3
  export interface CdnifyOptions extends CDNTransformerOptions {
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
2
  "name": "@altano/html-cdnify",
3
- "version": "3.0.1",
4
- "type": "module",
5
- "sideEffects": false,
6
- "exports": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
3
+ "version": "3.0.3",
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
- "html",
7
+ "cdnification",
12
8
  "cdnify",
13
- "cdnification"
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
- "homepage": "https://github.com/altano/npm-packages/tree/main/packages/html-cdnify",
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
- "license": "ISC",
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,18 +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.11.25",
43
+ "@types/node": "^20.16.5",
43
44
  "@types/stream-to-promise": "^2.2.4",
44
45
  "@types/streamifier": "^0.1.2",
45
- "eslint": "^8.57.0",
46
- "prettier": "^3.2.5",
47
- "typescript": "^5.4.2",
48
- "vite": "^5.2.8",
49
- "vitest": "^1.4.0",
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",
50
54
  "@altano/tsconfig": "0.0.0",
51
- "eslint-config-altano": "0.0.0"
55
+ "@altano/vitest-plugins": "0.2.0"
52
56
  },
53
57
  "engines": {
54
58
  "node": ">=5.10.1"
@@ -59,16 +63,17 @@
59
63
  "scripts": {
60
64
  "build": "tsup --config build-config/tsup.config.node.ts",
61
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",
62
69
  "clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
63
70
  "dev": "pnpm run build --watch",
64
71
  "format": "prettier --check src",
65
72
  "format:fix": "prettier --write src",
66
- "lint": "eslint package.json src/**/*.ts*",
73
+ "lint": "eslint",
67
74
  "lint:fix": "TIMING=1 pnpm lint --fix",
68
75
  "lint:timing": "TIMING=1 pnpm lint",
69
76
  "test:unit": "vitest --run",
70
- "test:unit:watch": "vitest",
71
- "typecheck:src": "tsc --noEmit",
72
- "typecheck:test": "tsc --noEmit --project ./tests/tsconfig.json"
77
+ "test:unit:watch": "vitest"
73
78
  }
74
79
  }