@ms-cloudpack/bundler-rollup 0.2.1 → 0.2.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.
package/lib/rollup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,OAAO,EAA8B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,OAAO,EAA8B,MAAM,4BAA4B,CAAC;AAYrG,eAAO,MAAM,MAAM,EAAE,OAsDpB,CAAC"}
|
package/lib/rollup.js
CHANGED
|
@@ -5,6 +5,7 @@ import { getRollupOptions } from './getRollupOptions.js';
|
|
|
5
5
|
import { normalizeRollupLoc } from './normalizeRollupLoc.js';
|
|
6
6
|
import { normalizeRollupOutput } from './normalizeRollupOutput.js';
|
|
7
7
|
import { rollupCapabilities } from './rollupCapabilities.js';
|
|
8
|
+
import { base64AssetExtensions } from '@ms-cloudpack/bundler-utilities';
|
|
8
9
|
const bundlerName = 'rollup';
|
|
9
10
|
export const rollup = {
|
|
10
11
|
name: bundlerName,
|
|
@@ -15,10 +16,7 @@ export const rollup = {
|
|
|
15
16
|
}
|
|
16
17
|
const { warnings, ...baseConfig } = await getRollupOptions({ options, newEntries });
|
|
17
18
|
const bundlerCapabilitiesOptions = {
|
|
18
|
-
|
|
19
|
-
// The extension are not read from the options because they are not configurable,
|
|
20
|
-
// but these are the supported extensions by the plugin
|
|
21
|
-
'asset-inline': { extensions: ['jpg', 'png', 'gif', 'svg', 'webp'] },
|
|
19
|
+
'asset-inline': { extensions: base64AssetExtensions },
|
|
22
20
|
...(options.bundlerCapabilities || {}),
|
|
23
21
|
};
|
|
24
22
|
const { inputOptions, outputOptions } = await processCapabilities({
|
package/lib/rollup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,MAAM,IAAI,SAAS,EAAuC,MAAM,QAAQ,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,MAAM,IAAI,SAAS,EAAuC,MAAM,QAAQ,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,GAAG,QAAQ,CAAC;AAE7B,MAAM,CAAC,MAAM,MAAM,GAAY;IAC7B,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,KAAK,WAAW,OAAO,EAAE,OAAO;QACtC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,qBAAqB,CAAC,OAAO,CAAC,C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;aACjB,CAAC;YAEF,IAAI,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;gBAChC,YAAY,CAAC,QAAQ,GAAG,kBAAkB,CAAC;oBACzC,2CAA2C;oBAC3C,GAAG,EAAE,KAAK,CAAC,GAAG;oBACd,sCAAsC;oBACtC,EAAE,EAAE,KAAK,CAAC,EAAE;oBACZ,SAAS,EAAE,OAAO,CAAC,SAAS;iBAC7B,CAAC,CAAC;YACL,CAAC;YAED,OAAO,EAAE,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,CAAC;QAED,OAAO,qBAAqB,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF,CAAC","sourcesContent":["import type { BundleMessage, Bundler, BundlerCapabilitiesOptions } from '@ms-cloudpack/common-types';\nimport { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';\nimport { rollup as runRollup, type RollupError, type RollupOutput } from 'rollup';\nimport { getRollupOptions } from './getRollupOptions.js';\nimport { normalizeRollupLoc } from './normalizeRollupLoc.js';\nimport { normalizeRollupOutput } from './normalizeRollupOutput.js';\nimport { rollupCapabilities } from './rollupCapabilities.js';\nimport { base64AssetExtensions } from '@ms-cloudpack/bundler-utilities';\n\nconst bundlerName = 'rollup';\n\nexport const rollup: Bundler = {\n name: bundlerName,\n bundle: async function (options, context) {\n const { newEntries, errors } = await writeESMStubsInWorker(options);\n if (errors?.length) {\n return { errors };\n }\n\n const { warnings, ...baseConfig } = await getRollupOptions({ options, newEntries });\n\n const bundlerCapabilitiesOptions: BundlerCapabilitiesOptions = {\n 'asset-inline': { extensions: base64AssetExtensions },\n ...(options.bundlerCapabilities || {}),\n };\n\n const { inputOptions, outputOptions } = await processCapabilities({\n bundlerName,\n baseConfig,\n bundlerCapabilitiesOptions,\n internalCapabilities: rollupCapabilities,\n bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,\n });\n\n let output: RollupOutput;\n\n try {\n const result = await runRollup(inputOptions);\n output = await result.write(outputOptions);\n await result.close();\n } catch (e) {\n // This might only be a regular Error, but the extra RollupError properties accessed are optional\n const error = e as RollupError;\n const errorMessage: BundleMessage = {\n text: error.message,\n // remove the message from the stack\n notes: [{ text: error.stack?.includes(error.message) ? error.stack.split(error.message)[1].trim() : '' }],\n source: 'rollup',\n };\n\n if (error.id || error.loc?.file) {\n errorMessage.location = normalizeRollupLoc({\n // contains line, column, and possibly file\n loc: error.loc,\n // some errors only have the file here\n id: error.id,\n inputPath: options.inputPath,\n });\n }\n\n return { errors: [errorMessage] };\n }\n\n return normalizeRollupOutput({ options, inputOptions, outputOptions, output, warnings });\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollupCapabilities.d.ts","sourceRoot":"","sources":["../src/rollupCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAO3D,eAAO,MAAM,kBAAkB,EAAE,wCAAwC,CAAC;IACxE,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B,
|
|
1
|
+
{"version":3,"file":"rollupCapabilities.d.ts","sourceRoot":"","sources":["../src/rollupCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAO3D,eAAO,MAAM,kBAAkB,EAAE,wCAAwC,CAAC;IACxE,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B,CA0BA,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { mergeObjects } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import
|
|
2
|
+
import _url from '@rollup/plugin-url';
|
|
3
3
|
// See more about the type workaround at getRollupPlugins.ts
|
|
4
|
-
const
|
|
4
|
+
const url = _url;
|
|
5
5
|
export const rollupCapabilities = {
|
|
6
|
-
'asset-inline': (config) => {
|
|
6
|
+
'asset-inline': (config, options) => {
|
|
7
|
+
const extensions = options.extensions.map((ext) => (ext.startsWith('.') ? ext.slice(1) : ext));
|
|
7
8
|
// Add the image plugin to the rollup configuration
|
|
8
9
|
if (!config.inputOptions.plugins) {
|
|
9
10
|
config.inputOptions.plugins = [];
|
|
@@ -11,7 +12,10 @@ export const rollupCapabilities = {
|
|
|
11
12
|
else if (!Array.isArray(config.inputOptions.plugins)) {
|
|
12
13
|
config.inputOptions.plugins = [config.inputOptions.plugins];
|
|
13
14
|
}
|
|
14
|
-
config.inputOptions.plugins.push(
|
|
15
|
+
config.inputOptions.plugins.push(url({
|
|
16
|
+
include: extensions.map((ext) => `**/*.${ext}`),
|
|
17
|
+
limit: 0, // Inline all files as Base64, regardless of size
|
|
18
|
+
}));
|
|
15
19
|
return config;
|
|
16
20
|
},
|
|
17
21
|
alias: (config, options) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollupCapabilities.js","sourceRoot":"","sources":["../src/rollupCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"rollupCapabilities.js","sourceRoot":"","sources":["../src/rollupCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,4DAA4D;AAC5D,MAAM,GAAG,GAAG,IAAsC,CAAC;AAEnD,MAAM,CAAC,MAAM,kBAAkB,G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alBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';\nimport type { OutputOptions, RollupOptions } from 'rollup';\nimport { mergeObjects } from '@ms-cloudpack/package-utilities';\nimport _url from '@rollup/plugin-url';\n\n// See more about the type workaround at getRollupPlugins.ts\nconst url = _url as unknown as typeof _url.default;\n\nexport const rollupCapabilities: InternalBundlerCapabilityImplementations<{\n inputOptions: RollupOptions;\n outputOptions: OutputOptions;\n}> = {\n 'asset-inline': (config, options) => {\n const extensions = options.extensions.map((ext) => (ext.startsWith('.') ? ext.slice(1) : ext));\n\n // Add the image plugin to the rollup configuration\n if (!config.inputOptions.plugins) {\n config.inputOptions.plugins = [];\n } else if (!Array.isArray(config.inputOptions.plugins)) {\n config.inputOptions.plugins = [config.inputOptions.plugins];\n }\n config.inputOptions.plugins.push(\n url({\n include: extensions.map((ext) => `**/*.${ext}`),\n limit: 0, // Inline all files as Base64, regardless of size\n }),\n );\n return config;\n },\n alias: (config, options) => {\n // Add aliases to the ori configuration\n config.outputOptions.paths = mergeObjects([config.outputOptions.paths || {}, options]);\n return config;\n },\n // This is a placeholder for the density capability. It doesn't do anything in the bundler.\n // It's just a workaround for a post-bundle task. This will be replaced with 'plugins' in the future.\n density: (config) => config,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-rollup",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A cloudpack plugin for abstracting rollup.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@ms-cloudpack/bundler-capabilities": "^0.2.3",
|
|
23
|
-
"@ms-cloudpack/bundler-utilities": "^0.1.
|
|
23
|
+
"@ms-cloudpack/bundler-utilities": "^0.1.16",
|
|
24
24
|
"@ms-cloudpack/common-types": "^0.23.6",
|
|
25
25
|
"@ms-cloudpack/esm-stub-utilities": "^0.13.20",
|
|
26
26
|
"@ms-cloudpack/package-utilities": "^10.4.2",
|
|
27
27
|
"@ms-cloudpack/path-string-parsing": "^1.2.5",
|
|
28
28
|
"@ms-cloudpack/path-utilities": "^2.7.56",
|
|
29
29
|
"@rollup/plugin-dynamic-import-vars": "^2.0.0",
|
|
30
|
-
"@rollup/plugin-image": "^3.0.0",
|
|
31
30
|
"@rollup/plugin-json": "^6.0.0",
|
|
32
31
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
33
32
|
"@rollup/plugin-replace": "^5.0.0",
|
|
34
33
|
"@rollup/plugin-swc": "^0.3.0",
|
|
35
34
|
"@rollup/plugin-terser": "^0.4.0",
|
|
35
|
+
"@rollup/plugin-url": "^8.0.0",
|
|
36
36
|
"@rollup/pluginutils": "^5.0.0",
|
|
37
37
|
"@swc/core": "^1.3.0",
|
|
38
38
|
"commondir": "^1.0.1",
|