@atproto-labs/rollup-plugin-bundle-manifest 0.2.0 → 0.3.0-next.0
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/LICENSE.txt +1 -1
- package/dist/index.js +7 -13
- package/dist/index.js.map +1 -1
- package/package.json +4 -6
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Dual MIT/Apache-2.0 License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022-
|
|
3
|
+
Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
|
|
4
4
|
|
|
5
5
|
Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.bundleManifest = bundleManifest;
|
|
7
|
-
const node_crypto_1 = require("node:crypto");
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
const mime_1 = __importDefault(require("mime"));
|
|
10
|
-
function bundleManifest({ name = 'bundle-manifest.json', data = false, } = {}) {
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { extname } from 'node:path';
|
|
3
|
+
import mime from 'mime';
|
|
4
|
+
export function bundleManifest({ name = 'bundle-manifest.json', data = false, } = {}) {
|
|
11
5
|
return {
|
|
12
6
|
name: 'bundle-manifest',
|
|
13
7
|
generateBundle(outputOptions, bundle) {
|
|
@@ -19,8 +13,8 @@ function bundleManifest({ name = 'bundle-manifest.json', data = false, } = {}) {
|
|
|
19
13
|
data: data
|
|
20
14
|
? Buffer.from(chunk.source).toString('base64')
|
|
21
15
|
: undefined,
|
|
22
|
-
mime:
|
|
23
|
-
sha256:
|
|
16
|
+
mime: mime.getType(extname(fileName)) || undefined,
|
|
17
|
+
sha256: createHash('sha256').update(chunk.source).digest('base64'),
|
|
24
18
|
};
|
|
25
19
|
}
|
|
26
20
|
if (chunk.type === 'chunk') {
|
|
@@ -28,7 +22,7 @@ function bundleManifest({ name = 'bundle-manifest.json', data = false, } = {}) {
|
|
|
28
22
|
type: chunk.type,
|
|
29
23
|
data: data ? Buffer.from(chunk.code).toString('base64') : undefined,
|
|
30
24
|
mime: 'application/javascript',
|
|
31
|
-
sha256:
|
|
25
|
+
sha256: createHash('sha256').update(chunk.code).digest('base64'),
|
|
32
26
|
dynamicImports: chunk.dynamicImports,
|
|
33
27
|
isDynamicEntry: chunk.isDynamicEntry,
|
|
34
28
|
isEntry: chunk.isEntry,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,IAAI,MAAM,MAAM,CAAA;AA0BvB,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,GAAG,sBAAsB,EAC7B,IAAI,GAAG,KAAK,MAIV,EAAE;IACJ,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,cAAc,CAAC,aAAa,EAAE,MAAM;YAClC,MAAM,QAAQ,GAAa,EAAE,CAAA;YAE7B,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBACvD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC3B,QAAQ,CAAC,QAAQ,CAAC,GAAG;wBACnB,IAAI,EAAE,KAAK,CAAC,IAAI;w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H,CAAC","sourcesContent":["import { createHash } from 'node:crypto'\nimport { extname } from 'node:path'\nimport mime from 'mime'\nimport type { Plugin } from 'rollup'\n\ntype AssetItem = {\n type: 'asset'\n mime?: string\n sha256: string\n data?: string\n}\n\ntype ChunkItem = {\n type: 'chunk'\n mime: string\n sha256: string\n dynamicImports: string[]\n isDynamicEntry: boolean\n isEntry: boolean\n isImplicitEntry: boolean\n name: string\n data?: string\n}\n\nexport type ManifestItem = AssetItem | ChunkItem\n\nexport type Manifest = Record<string, ManifestItem>\n\nexport function bundleManifest({\n name = 'bundle-manifest.json',\n data = false,\n}: {\n name?: string\n data?: boolean\n} = {}): Plugin<never> {\n return {\n name: 'bundle-manifest',\n generateBundle(outputOptions, bundle) {\n const manifest: Manifest = {}\n\n for (const [fileName, chunk] of Object.entries(bundle)) {\n if (chunk.type === 'asset') {\n manifest[fileName] = {\n type: chunk.type,\n data: data\n ? Buffer.from(chunk.source).toString('base64')\n : undefined,\n mime: mime.getType(extname(fileName)) || undefined,\n sha256: createHash('sha256').update(chunk.source).digest('base64'),\n }\n }\n\n if (chunk.type === 'chunk') {\n manifest[fileName] = {\n type: chunk.type,\n data: data ? Buffer.from(chunk.code).toString('base64') : undefined,\n mime: 'application/javascript',\n sha256: createHash('sha256').update(chunk.code).digest('base64'),\n dynamicImports: chunk.dynamicImports,\n isDynamicEntry: chunk.isDynamicEntry,\n isEntry: chunk.isEntry,\n isImplicitEntry: chunk.isImplicitEntry,\n name: chunk.name,\n }\n }\n }\n\n this.emitFile({\n type: 'asset',\n fileName: name,\n source: JSON.stringify(manifest, null, 2),\n })\n },\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto-labs/rollup-plugin-bundle-manifest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Library for generating a manifest of bundled files from a Rollup build",
|
|
6
6
|
"keywords": [
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/bluesky-social/atproto",
|
|
15
15
|
"directory": "packages/internal/rollup-plugin-bundle-manifest"
|
|
16
16
|
},
|
|
17
|
-
"type": "
|
|
18
|
-
"main": "dist/index.js",
|
|
19
|
-
"types": "dist/index.d.ts",
|
|
17
|
+
"type": "module",
|
|
20
18
|
"exports": {
|
|
21
19
|
".": {
|
|
22
20
|
"types": "./dist/index.d.ts",
|
|
@@ -24,7 +22,7 @@
|
|
|
24
22
|
}
|
|
25
23
|
},
|
|
26
24
|
"engines": {
|
|
27
|
-
"node": ">=
|
|
25
|
+
"node": ">=22"
|
|
28
26
|
},
|
|
29
27
|
"files": [
|
|
30
28
|
"dist"
|
|
@@ -37,7 +35,7 @@
|
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
37
|
"rollup": "^4.10.0",
|
|
40
|
-
"typescript": "^
|
|
38
|
+
"typescript": "^6.0.3"
|
|
41
39
|
},
|
|
42
40
|
"scripts": {
|
|
43
41
|
"build": "tsc --build tsconfig.json"
|