@eik/rollup-plugin 4.0.10 → 4.0.11
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/CHANGELOG.md +7 -0
- package/dist/plugin.cjs +14 -13
- package/package.json +10 -14
- package/src/plugin.js +14 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [4.0.11](https://github.com/eik-lib/rollup-plugin/compare/v4.0.10...v4.0.11) (2022-01-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Fix node-fetch 3.x regression in CJS build ([#70](https://github.com/eik-lib/rollup-plugin/issues/70)) ([16b71c9](https://github.com/eik-lib/rollup-plugin/commit/16b71c97c08c6840ffd6df3b9d1520037dfe3257))
|
|
7
|
+
|
|
1
8
|
## [4.0.10](https://github.com/eik-lib/rollup-plugin/compare/v4.0.9...v4.0.10) (2022-01-11)
|
|
2
9
|
|
|
3
10
|
|
package/dist/plugin.cjs
CHANGED
|
@@ -2,33 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
var rollupPluginImportMap = require('rollup-plugin-import-map');
|
|
4
4
|
var common = require('@eik/common');
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
|
|
5
|
+
var undici = require('undici');
|
|
10
6
|
|
|
11
7
|
/* eslint-disable no-restricted-syntax */
|
|
12
8
|
|
|
13
|
-
async
|
|
9
|
+
const fetchImportMaps = async (urls = []) => {
|
|
14
10
|
try {
|
|
15
|
-
const maps = urls.map(
|
|
16
|
-
|
|
11
|
+
const maps = urls.map(async (map) => {
|
|
12
|
+
const {
|
|
13
|
+
statusCode,
|
|
14
|
+
body,
|
|
15
|
+
} = await undici.request(map, { maxRedirections: 2 });
|
|
16
|
+
|
|
17
|
+
if (statusCode === 404) {
|
|
17
18
|
throw new Error('Import map could not be found on server');
|
|
18
|
-
} else if (
|
|
19
|
+
} else if (statusCode >= 400 && statusCode < 500) {
|
|
19
20
|
throw new Error('Server rejected client request');
|
|
20
|
-
} else if (
|
|
21
|
+
} else if (statusCode >= 500) {
|
|
21
22
|
throw new Error('Server error');
|
|
22
23
|
}
|
|
23
|
-
return
|
|
24
|
-
})
|
|
24
|
+
return body.json();
|
|
25
|
+
});
|
|
25
26
|
return await Promise.all(maps);
|
|
26
27
|
} catch (err) {
|
|
27
28
|
throw new Error(
|
|
28
29
|
`Unable to load import map file from server: ${err.message}`,
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
|
-
}
|
|
32
|
+
};
|
|
32
33
|
|
|
33
34
|
function esmImportToUrl({
|
|
34
35
|
path = process.cwd(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eik/rollup-plugin",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.11",
|
|
4
4
|
"description": "Rollup plugin for loading import maps from a Eik server and applying the mapping to ECMAScript modules in preparation for upload to the same server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin.cjs",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"prepare": "npm run -s build",
|
|
22
|
-
"test": "tap --no-
|
|
23
|
-
"test:snapshot": "TAP_SNAPSHOT=1 tap --no-
|
|
22
|
+
"test": "tap --no-coverage",
|
|
23
|
+
"test:snapshot": "TAP_SNAPSHOT=1 tap --no-coverage",
|
|
24
24
|
"lint": "eslint . --ext=js",
|
|
25
25
|
"lint:fix": "eslint . --fix --ext=js",
|
|
26
26
|
"start": "node --experimental-modules ./example/server.mjs",
|
|
@@ -46,22 +46,18 @@
|
|
|
46
46
|
"homepage": "https://github.com/eik-lib/rollup-plugin#readme",
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@semantic-release/changelog": "6.0.1",
|
|
49
|
-
"@semantic-release/commit-analyzer": "9.0.2",
|
|
50
49
|
"@semantic-release/git": "10.0.1",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"eslint-plugin-import": "2.24.0",
|
|
57
|
-
"fastify": "3.14.1",
|
|
58
|
-
"rollup": "2.39.0",
|
|
50
|
+
"eslint": "8.6.0",
|
|
51
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
52
|
+
"eslint-plugin-import": "2.25.4",
|
|
53
|
+
"fastify": "3.25.3",
|
|
54
|
+
"rollup": "2.63.0",
|
|
59
55
|
"semantic-release": "18.0.1",
|
|
60
|
-
"tap": "
|
|
56
|
+
"tap": "15.1.6"
|
|
61
57
|
},
|
|
62
58
|
"dependencies": {
|
|
63
59
|
"@eik/common": "3.0.0",
|
|
64
|
-
"
|
|
60
|
+
"undici": "4.12.1",
|
|
65
61
|
"rollup-plugin-import-map": "2.2.2"
|
|
66
62
|
}
|
|
67
63
|
}
|
package/src/plugin.js
CHANGED
|
@@ -2,27 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
import { rollupImportMapPlugin as importMapPlugin } from 'rollup-plugin-import-map';
|
|
4
4
|
import { helpers } from '@eik/common';
|
|
5
|
-
import
|
|
5
|
+
import { request } from 'undici';
|
|
6
6
|
|
|
7
|
-
async
|
|
7
|
+
const fetchImportMaps = async (urls = []) => {
|
|
8
8
|
try {
|
|
9
|
-
const maps = urls.map(
|
|
10
|
-
|
|
9
|
+
const maps = urls.map(async (map) => {
|
|
10
|
+
const {
|
|
11
|
+
statusCode,
|
|
12
|
+
body,
|
|
13
|
+
} = await request(map, { maxRedirections: 2 });
|
|
14
|
+
|
|
15
|
+
if (statusCode === 404) {
|
|
11
16
|
throw new Error('Import map could not be found on server');
|
|
12
|
-
} else if (
|
|
17
|
+
} else if (statusCode >= 400 && statusCode < 500) {
|
|
13
18
|
throw new Error('Server rejected client request');
|
|
14
|
-
} else if (
|
|
19
|
+
} else if (statusCode >= 500) {
|
|
15
20
|
throw new Error('Server error');
|
|
16
21
|
}
|
|
17
|
-
return
|
|
18
|
-
})
|
|
22
|
+
return body.json();
|
|
23
|
+
});
|
|
19
24
|
return await Promise.all(maps);
|
|
20
25
|
} catch (err) {
|
|
21
26
|
throw new Error(
|
|
22
27
|
`Unable to load import map file from server: ${err.message}`,
|
|
23
28
|
);
|
|
24
29
|
}
|
|
25
|
-
}
|
|
30
|
+
};
|
|
26
31
|
|
|
27
32
|
export default function esmImportToUrl({
|
|
28
33
|
path = process.cwd(),
|