@eik/webpack-plugin 2.0.8 → 3.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eik/webpack-plugin",
3
- "version": "2.0.8",
3
+ "version": "3.0.1",
4
4
  "description": "WebPack plugin for loading import maps from an Eik server and applying the mapping to ECMAScript modules in preparation for upload to the same server.",
5
5
  "type": "module",
6
6
  "main": "./src/loader.js",
@@ -38,24 +38,26 @@
38
38
  },
39
39
  "homepage": "https://github.com/eik-lib/webpack-plugin#readme",
40
40
  "devDependencies": {
41
- "@eik/eslint-config": "1.0.10",
41
+ "@eik/eslint-config": "1.0.15",
42
42
  "@eik/prettier-config": "1.0.1",
43
- "@eik/semantic-release-config": "1.0.0",
43
+ "@eik/semantic-release-config": "1.0.2",
44
44
  "@eik/typescript-config": "1.0.0",
45
- "eslint": "9.17.0",
46
- "fastify": "4.28.1",
47
- "memfs": "4.14.0",
48
- "npm-run-all2": "5.0.2",
49
- "prettier": "3.3.3",
45
+ "eslint": "9.26.0",
46
+ "fastify": "5.3.2",
47
+ "memfs": "4.17.1",
48
+ "npm-run-all2": "8.0.1",
49
+ "prettier": "3.5.3",
50
50
  "rimraf": "6.0.1",
51
51
  "semantic-release": "24.2.3",
52
- "tap": "21.0.1",
53
- "typescript": "5.5.4",
54
- "webpack": "5.93.0",
55
- "webpack-cli": "5.1.4"
52
+ "tap": "21.1.0",
53
+ "typescript": "5.8.3",
54
+ "webpack": "5.99.8",
55
+ "webpack-cli": "6.0.1"
56
56
  },
57
57
  "dependencies": {
58
- "@eik/common": "3.0.1",
59
- "undici": "6.21.2"
58
+ "@eik/common": "5.1.1"
59
+ },
60
+ "engines": {
61
+ "node": ">=20"
60
62
  }
61
63
  }
package/src/loader.js CHANGED
@@ -9,6 +9,11 @@ import {
9
9
  const dictionary = new Map();
10
10
  let cold = true;
11
11
 
12
+ /**
13
+ * @typedef {object} ImportMap
14
+ * @property {Record<string, string>} imports
15
+ */
16
+
12
17
  /**
13
18
  * @param {string} source
14
19
  */
@@ -39,7 +44,7 @@ export default async function loader(source) {
39
44
  const eikConfig = await helpers.getDefaults(pPath);
40
45
 
41
46
  // Merge map from eik config and the plugin options and Fetch all import maps over http
42
- const fetchedMaps = await utils.fetchImportMaps([
47
+ const fetchedMaps = await helpers.fetchImportMaps([
43
48
  ...eikConfig.map,
44
49
  ...urls,
45
50
  ]);
package/src/utils.js CHANGED
@@ -1,5 +1,3 @@
1
- import { request } from "undici";
2
-
3
1
  /**
4
2
  * Whether or not a string looks like a bare import.
5
3
  * @param {string} str
@@ -25,6 +23,11 @@ export const isBare = (str) => {
25
23
  */
26
24
  export const isString = (str) => typeof str === "string";
27
25
 
26
+ /**
27
+ * @typedef {object} ImportMap
28
+ * @property {Record<string, string>} imports
29
+ */
30
+
28
31
  /**
29
32
  * @param {ImportMap} map
30
33
  * @returns {Array<{ key: string; value: string; }>}
@@ -41,35 +44,3 @@ export const validate = (map) =>
41
44
 
42
45
  return { key, value };
43
46
  });
44
-
45
- /**
46
- * @typedef {object} ImportMap
47
- * @property {Record<string, string>} imports
48
- */
49
-
50
- /**
51
- * @param {string[]} urls
52
- * @returns {Promise<ImportMap[]>}
53
- */
54
- export const fetchImportMaps = async (urls = []) => {
55
- try {
56
- const maps = urls.map(async (map) => {
57
- const { statusCode, body } = await request(map, { maxRedirections: 2 });
58
-
59
- if (statusCode === 404) {
60
- throw new Error("Import map could not be found on server");
61
- } else if (statusCode >= 400 && statusCode < 500) {
62
- throw new Error("Server rejected client request");
63
- } else if (statusCode >= 500) {
64
- throw new Error("Server error");
65
- }
66
-
67
- return /** @type {Promise<ImportMap>} */ (body.json());
68
- });
69
- return await Promise.all(maps);
70
- } catch (err) {
71
- throw new Error(
72
- `Unable to load import map file from server: ${err.message}`,
73
- );
74
- }
75
- };
package/types/loader.d.ts CHANGED
@@ -1,4 +1,11 @@
1
+ /**
2
+ * @typedef {object} ImportMap
3
+ * @property {Record<string, string>} imports
4
+ */
1
5
  /**
2
6
  * @param {string} source
3
7
  */
4
8
  export default function loader(source: string): Promise<void>;
9
+ export type ImportMap = {
10
+ imports: Record<string, string>;
11
+ };
package/types/utils.d.ts CHANGED
@@ -4,7 +4,6 @@ export function validate(map: ImportMap): Array<{
4
4
  key: string;
5
5
  value: string;
6
6
  }>;
7
- export function fetchImportMaps(urls?: string[]): Promise<ImportMap[]>;
8
7
  export type ImportMap = {
9
8
  imports: Record<string, string>;
10
9
  };