@ms-cloudpack/bundler-rollup 0.6.2 → 0.6.3
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/getRollupCapabilities.d.ts +9 -0
- package/lib/getRollupCapabilities.d.ts.map +1 -0
- package/lib/{rollupCapabilities.js → getRollupCapabilities.js} +10 -4
- package/lib/getRollupCapabilities.js.map +1 -0
- package/lib/rollup.d.ts.map +1 -1
- package/lib/rollup.js +4 -2
- package/lib/rollup.js.map +1 -1
- package/package.json +2 -1
- package/lib/rollupCapabilities.d.ts +0 -7
- package/lib/rollupCapabilities.d.ts.map +0 -1
- package/lib/rollupCapabilities.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BundleContext, InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { OutputOptions, RollupOptions } from 'rollup';
|
|
3
|
+
import type { DefineFlags } from '@ms-cloudpack/common-types-browser';
|
|
4
|
+
export declare function toReplaceValues(defs: DefineFlags): Record<string, string>;
|
|
5
|
+
export declare const getRollupCapabilities: (context: Pick<BundleContext, "config">) => InternalBundlerCapabilityImplementations<{
|
|
6
|
+
inputOptions: RollupOptions;
|
|
7
|
+
outputOptions: OutputOptions;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=getRollupCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRollupCapabilities.d.ts","sourceRoot":"","sources":["../src/getRollupCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC1G,OAAO,KAAK,EAAE,aAAa,EAAU,aAAa,EAAE,MAAM,QAAQ,CAAC;AAKnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAiBtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIzE;AAED,eAAO,MAAM,qBAAqB,GAChC,SAAS,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,KACrC,wCAAwC,CAAC;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAwCC,CAAC"}
|
|
@@ -17,7 +17,10 @@ function pushPlugin(inputOptions, plugin) {
|
|
|
17
17
|
inputOptions.plugins = [inputOptions.plugins, plugin];
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export function toReplaceValues(defs) {
|
|
21
|
+
return Object.fromEntries(Object.entries(defs).map(([k, v]) => [k, typeof v === 'object' ? JSON.stringify(v) : v.toString()]));
|
|
22
|
+
}
|
|
23
|
+
export const getRollupCapabilities = (context) => ({
|
|
21
24
|
'asset-inline': (config, options) => {
|
|
22
25
|
// Process extensions based on format (array or object)
|
|
23
26
|
const extensions = processAssetInlineExtensions(options.extensions);
|
|
@@ -38,7 +41,10 @@ export const rollupCapabilities = {
|
|
|
38
41
|
define: (config, options) => {
|
|
39
42
|
pushPlugin(config.inputOptions, replace({
|
|
40
43
|
preventAssignment: true,
|
|
41
|
-
values:
|
|
44
|
+
values: {
|
|
45
|
+
...(context.config.mode === 'production' ? toReplaceValues(context.config.define ?? {}) : {}),
|
|
46
|
+
...options,
|
|
47
|
+
},
|
|
42
48
|
}));
|
|
43
49
|
return config;
|
|
44
50
|
},
|
|
@@ -47,5 +53,5 @@ export const rollupCapabilities = {
|
|
|
47
53
|
// This is a placeholder for the density capability. It doesn't do anything in the bundler.
|
|
48
54
|
// It's just a workaround for a post-bundle task. This will be replaced with 'plugins' in the future.
|
|
49
55
|
density: (config) => config,
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=getRollupCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRollupCapab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C,MAAM;CAC5B,CAAC,CAAC","sourcesContent":["import type { BundleContext, InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';\nimport type { OutputOptions, Plugin, RollupOptions } from 'rollup';\nimport { mergeObjects } from '@ms-cloudpack/package-utilities';\nimport { processAssetInlineExtensions } from '@ms-cloudpack/bundler-utilities';\nimport _url from '@rollup/plugin-url';\nimport _replace from '@rollup/plugin-replace';\nimport type { DefineFlags } from '@ms-cloudpack/common-types-browser';\n\n// See more about the type workaround at getRollupPlugins.ts\nconst url = _url as unknown as typeof _url.default;\nconst replace = _replace as unknown as typeof _replace.default;\n\n// Small helper to normalize and push a plugin into RollupOptions.plugins\nfunction pushPlugin(inputOptions: RollupOptions, plugin: Plugin) {\n if (!inputOptions.plugins) {\n inputOptions.plugins = [plugin];\n } else if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.push(plugin);\n } else {\n inputOptions.plugins = [inputOptions.plugins, plugin];\n }\n}\n\nexport function toReplaceValues(defs: DefineFlags): Record<string, string> {\n return Object.fromEntries(\n Object.entries(defs).map(([k, v]) => [k, typeof v === 'object' ? JSON.stringify(v) : v.toString()]),\n );\n}\n\nexport const getRollupCapabilities = (\n context: Pick<BundleContext, 'config'>,\n): InternalBundlerCapabilityImplementations<{\n inputOptions: RollupOptions;\n outputOptions: OutputOptions;\n}> => ({\n 'asset-inline': (config, options) => {\n // Process extensions based on format (array or object)\n const extensions = processAssetInlineExtensions(options.extensions);\n\n // Add the image plugin to the rollup configuration\n pushPlugin(\n config.inputOptions,\n url({\n include: extensions.map((ext) => `**/*${ext}`),\n limit: Number.POSITIVE_INFINITY, // 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 just a placeholder for the resolve-web-extensions capability. It is handled in getRollupPlugins.ts.\n 'resolve-web-extensions': (config) => config,\n define: (config, options) => {\n pushPlugin(\n config.inputOptions,\n replace({\n preventAssignment: true,\n values: {\n ...(context.config.mode === 'production' ? toReplaceValues(context.config.define ?? {}) : {}),\n ...options,\n },\n }),\n );\n return config;\n },\n // This is just a placeholder for the relay capability. It is handled in getRollupPlugins.ts.\n relay: (config) => config,\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/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,EAEV,OAAO,EAGR,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,QAAQ,CAAC;AAOhB,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAIF,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,OAAO,EAGR,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,QAAQ,CAAC;AAOhB,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAIF,eAAO,MAAM,MAAM,EAAE,OAyDpB,CAAC"}
|
package/lib/rollup.js
CHANGED
|
@@ -4,7 +4,7 @@ import { rollup as runRollup, VERSION, } from 'rollup';
|
|
|
4
4
|
import { getRollupOptions } from './getRollupOptions.js';
|
|
5
5
|
import { normalizeRollupLoc } from './normalizeRollupLoc.js';
|
|
6
6
|
import { normalizeRollupOutput } from './normalizeRollupOutput.js';
|
|
7
|
-
import {
|
|
7
|
+
import { getRollupCapabilities } from './getRollupCapabilities.js';
|
|
8
8
|
import { base64AssetExtensions } from '@ms-cloudpack/path-utilities';
|
|
9
9
|
const bundlerName = 'rollup';
|
|
10
10
|
export const rollup = {
|
|
@@ -18,13 +18,15 @@ export const rollup = {
|
|
|
18
18
|
const { warnings, ...baseConfig } = getRollupOptions({ options, context, newEntries });
|
|
19
19
|
const bundlerCapabilitiesOptions = {
|
|
20
20
|
'asset-inline': { extensions: base64AssetExtensions },
|
|
21
|
+
// Enable define capability by default
|
|
22
|
+
define: true,
|
|
21
23
|
...(options.bundlerCapabilities || {}),
|
|
22
24
|
};
|
|
23
25
|
const { inputOptions, outputOptions } = await processCapabilities({
|
|
24
26
|
bundlerName,
|
|
25
27
|
baseConfig,
|
|
26
28
|
bundlerCapabilitiesOptions,
|
|
27
|
-
internalCapabilities:
|
|
29
|
+
internalCapabilities: getRollupCapabilities(context),
|
|
28
30
|
bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,
|
|
29
31
|
});
|
|
30
32
|
let output;
|
package/lib/rollup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EACL,MAAM,IAAI,SAAS,EAGnB,OAAO,GAGR,MAAM,QAAQ,CAAC;AAChB,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,
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":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AQ,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF,CAAC","sourcesContent":["import type {\n BundleMessage,\n Bundler,\n BundlerCapabilitiesOptions,\n InternalBundlerCapabilitiesOptions,\n} from '@ms-cloudpack/common-types';\nimport { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';\nimport {\n rollup as runRollup,\n type RollupError,\n type RollupOutput,\n VERSION,\n type RollupOptions,\n type OutputOptions,\n} from 'rollup';\nimport { getRollupOptions } from './getRollupOptions.js';\nimport { normalizeRollupLoc } from './normalizeRollupLoc.js';\nimport { normalizeRollupOutput } from './normalizeRollupOutput.js';\nimport { getRollupCapabilities } from './getRollupCapabilities.js';\nimport { base64AssetExtensions } from '@ms-cloudpack/path-utilities';\n\nexport type RollupCapabilityConfig = {\n inputOptions: RollupOptions;\n outputOptions: OutputOptions;\n};\n\nconst bundlerName = 'rollup';\n\nexport const rollup: Bundler = {\n name: bundlerName,\n version: VERSION,\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 } = getRollupOptions({ options, context, newEntries });\n\n const bundlerCapabilitiesOptions: BundlerCapabilitiesOptions = {\n 'asset-inline': { extensions: base64AssetExtensions },\n // Enable define capability by default\n define: true,\n ...(options.bundlerCapabilities || {}),\n } satisfies InternalBundlerCapabilitiesOptions;\n\n const { inputOptions, outputOptions } = await processCapabilities<RollupCapabilityConfig>({\n bundlerName,\n baseConfig,\n bundlerCapabilitiesOptions,\n internalCapabilities: getRollupCapabilities(context),\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-rollup",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Cloudpack's wrapper for the Rollup bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@ms-cloudpack/bundler-capabilities": "^0.5.0",
|
|
29
29
|
"@ms-cloudpack/bundler-utilities": "^0.8.0",
|
|
30
30
|
"@ms-cloudpack/common-types": "^0.33.1",
|
|
31
|
+
"@ms-cloudpack/common-types-browser": "^0.6.4",
|
|
31
32
|
"@ms-cloudpack/esm-stub-utilities": "^0.15.35",
|
|
32
33
|
"@ms-cloudpack/package-utilities": "^13.2.5",
|
|
33
34
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';
|
|
2
|
-
import type { OutputOptions, RollupOptions } from 'rollup';
|
|
3
|
-
export declare const rollupCapabilities: InternalBundlerCapabilityImplementations<{
|
|
4
|
-
inputOptions: RollupOptions;
|
|
5
|
-
outputOptions: OutputOptions;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=rollupCapabilities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollupCapabilities.d.ts","sourceRoot":"","sources":["../src/r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AAG,4BAA4B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAEpE,mDAAmD;QACnD,UAAU,CACR,MAAM,CAAC,YAAY,EACnB,GAAG,CAAC;YACF,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC;YAC9C,KAAK,EAAE,MAAM,CAAC,iBAAiB,EAAE,iDAAiD;SACnF,CAAC,CACH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QACzB,uCAAuC;QACvC,MAAM,CAAC,aAAa,CAAC,KAAK,GAAG,YAAY,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;QACvF,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,8GAA8G;IAC9G,wBAAwB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;IAC5C,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAC1B,UAAU,CACR,MAAM,CAAC,YAAY,EACnB,OAAO,CAAC;YACN,iBAAiB,EAAE,IAAI;YACvB,MAAM,EAAE,OAAO;SAChB,CAAC,CACH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,6FAA6F;IAC7F,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;IACzB,2FAA2F;IAC3F,qGAAqG;IACrG,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;CAC5B,CAAC","sourcesContent":["import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';\nimport type { OutputOptions, Plugin, RollupOptions } from 'rollup';\nimport { mergeObjects } from '@ms-cloudpack/package-utilities';\nimport { processAssetInlineExtensions } from '@ms-cloudpack/bundler-utilities';\nimport _url from '@rollup/plugin-url';\nimport _replace from '@rollup/plugin-replace';\n\n// See more about the type workaround at getRollupPlugins.ts\nconst url = _url as unknown as typeof _url.default;\nconst replace = _replace as unknown as typeof _replace.default;\n\n// Small helper to normalize and push a plugin into RollupOptions.plugins\nfunction pushPlugin(inputOptions: RollupOptions, plugin: Plugin) {\n if (!inputOptions.plugins) {\n inputOptions.plugins = [plugin];\n } else if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.push(plugin);\n } else {\n inputOptions.plugins = [inputOptions.plugins, plugin];\n }\n}\n\nexport const rollupCapabilities: InternalBundlerCapabilityImplementations<{\n inputOptions: RollupOptions;\n outputOptions: OutputOptions;\n}> = {\n 'asset-inline': (config, options) => {\n // Process extensions based on format (array or object)\n const extensions = processAssetInlineExtensions(options.extensions);\n\n // Add the image plugin to the rollup configuration\n pushPlugin(\n config.inputOptions,\n url({\n include: extensions.map((ext) => `**/*${ext}`),\n limit: Number.POSITIVE_INFINITY, // 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 just a placeholder for the resolve-web-extensions capability. It is handled in getRollupPlugins.ts.\n 'resolve-web-extensions': (config) => config,\n define: (config, options) => {\n pushPlugin(\n config.inputOptions,\n replace({\n preventAssignment: true,\n values: options,\n }),\n );\n return config;\n },\n // This is just a placeholder for the relay capability. It is handled in getRollupPlugins.ts.\n relay: (config) => config,\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"]}
|