@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.
@@ -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 | undefined) => string;
19
+ static defaultTransformFunction: (newUrlBase: string, oldUrl: string, pathOldUrlIsRelativeTo?: string) => string;
20
20
  }
21
21
  //# sourceMappingURL=CDNTransformer.d.ts.map
@@ -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,4 +1,4 @@
1
- import HtmlTransformer from "./HtmlTransformer";
1
+ import HtmlTransformer from "./HtmlTransformer.js";
2
2
  export interface HtmlAttributeStreamTransformerOptions {
3
3
  transformDefinitions: TransformDefinition[];
4
4
  transformFunction: TransformFunction;
@@ -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.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" />
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,6 +1,5 @@
1
- /// <reference types="node" />
2
- import { CDNTransformerOptions } from "./CDNTransformer";
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.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
- "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,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.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
- "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",
49
54
  "@altano/tsconfig": "0.0.0",
50
- "eslint-config-altano": "0.0.0"
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 package.json src/**/*.ts*",
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
  }