@ms-cloudpack/bundler-rollup 0.4.11 → 0.4.13

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.
@@ -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,CA4BA,CAAC"}
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,EAAU,aAAa,EAAE,MAAM,QAAQ,CAAC;AAoBnE,eAAO,MAAM,kBAAkB,EAAE,wCAAwC,CAAC;IACxE,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAkCA,CAAC"}
@@ -1,18 +1,26 @@
1
1
  import { mergeObjects } from '@ms-cloudpack/package-utilities';
2
2
  import _url from '@rollup/plugin-url';
3
+ import _replace from '@rollup/plugin-replace';
3
4
  // See more about the type workaround at getRollupPlugins.ts
4
5
  const url = _url;
6
+ const replace = _replace;
7
+ // Small helper to normalize and push a plugin into RollupOptions.plugins
8
+ function pushPlugin(inputOptions, plugin) {
9
+ if (!inputOptions.plugins) {
10
+ inputOptions.plugins = [plugin];
11
+ }
12
+ else if (Array.isArray(inputOptions.plugins)) {
13
+ inputOptions.plugins.push(plugin);
14
+ }
15
+ else {
16
+ inputOptions.plugins = [inputOptions.plugins, plugin];
17
+ }
18
+ }
5
19
  export const rollupCapabilities = {
6
20
  'asset-inline': (config, options) => {
7
21
  const extensions = options.extensions.map((ext) => (ext.startsWith('.') ? ext.slice(1) : ext));
8
22
  // Add the image plugin to the rollup configuration
9
- if (!config.inputOptions.plugins) {
10
- config.inputOptions.plugins = [];
11
- }
12
- else if (!Array.isArray(config.inputOptions.plugins)) {
13
- config.inputOptions.plugins = [config.inputOptions.plugins];
14
- }
15
- config.inputOptions.plugins.push(url({
23
+ pushPlugin(config.inputOptions, url({
16
24
  include: extensions.map((ext) => `**/*.${ext}`),
17
25
  limit: 0, // Inline all files as Base64, regardless of size
18
26
  }));
@@ -25,6 +33,13 @@ export const rollupCapabilities = {
25
33
  },
26
34
  // This is just a placeholder for the resolve-web-extensions capability. It is handled in getRollupPlugins.ts.
27
35
  'resolve-web-extensions': (config) => config,
36
+ define: (config, options) => {
37
+ pushPlugin(config.inputOptions, replace({
38
+ preventAssignment: true,
39
+ values: options,
40
+ }));
41
+ return config;
42
+ },
28
43
  // This is a placeholder for the density capability. It doesn't do anything in the bundler.
29
44
  // It's just a workaround for a post-bundle task. This will be replaced with 'plugins' in the future.
30
45
  density: (config) => config,
@@ -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,IAAI,MAAM,oBAAoB,CAAC;AAEtC,4DAA4D;AAC5D,MAAM,GAAG,GAAG,IAAsC,CAAC;AAEnD,MAAM,CAAC,MAAM,kBAAkB,GAG1B;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAClC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE/F,mDAAmD;QACnD,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,CAAC,YAAY,CAAC,OAAO,GAAG,EAAE,CAAC;QACnC,CAAC;aAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;YACvD,MAAM,CAAC,YAAY,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAC9B,GAAG,CAAC;YACF,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC;YAC/C,KAAK,EAAE,CAAC,EAAE,iDAAiD;SAC5D,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,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, 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 just a placeholder for the resolve-web-extensions capability. It is handled in getRollupPlugins.ts.\n 'resolve-web-extensions': (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"]}
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;AACtC,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,4DAA4D;AAC5D,MAAM,GAAG,GAAG,IAAsC,CAAC;AACnD,MAAM,OAAO,GAAG,QAA8C,CAAC;AAE/D,yEAAyE;AACzE,SAAS,UAAU,CAAC,YAA2B,EAAE,MAAc;IAC7D,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC1B,YAAY,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/C,Y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CAAC,CACH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,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 _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 const extensions = options.extensions.map((ext) => (ext.startsWith('.') ? ext.slice(1) : ext));\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: 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 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 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.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "A cloudpack plugin for abstracting rollup.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,13 +14,13 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/bundler-capabilities": "^0.2.39",
18
- "@ms-cloudpack/bundler-utilities": "^0.5.6",
19
- "@ms-cloudpack/common-types": "^0.27.4",
20
- "@ms-cloudpack/esm-stub-utilities": "^0.15.12",
21
- "@ms-cloudpack/package-utilities": "^12.3.25",
17
+ "@ms-cloudpack/bundler-capabilities": "^0.3.1",
18
+ "@ms-cloudpack/bundler-utilities": "^0.5.8",
19
+ "@ms-cloudpack/common-types": "^0.27.6",
20
+ "@ms-cloudpack/esm-stub-utilities": "^0.15.14",
21
+ "@ms-cloudpack/package-utilities": "^12.5.0",
22
22
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
23
- "@ms-cloudpack/path-utilities": "^3.1.19",
23
+ "@ms-cloudpack/path-utilities": "^3.1.21",
24
24
  "@rollup/plugin-commonjs": "^28.0.4",
25
25
  "@rollup/plugin-dynamic-import-vars": "^2.0.0",
26
26
  "@rollup/plugin-node-resolve": "^16.0.0",