@ms-cloudpack/bundler-rollup 0.6.1 → 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.
Files changed (50) hide show
  1. package/lib/getRollupCapabilities.d.ts +9 -0
  2. package/lib/getRollupCapabilities.d.ts.map +1 -0
  3. package/lib/{rollupCapabilities.js → getRollupCapabilities.js} +10 -4
  4. package/lib/getRollupCapabilities.js.map +1 -0
  5. package/lib/getRollupPlugins.d.ts.map +1 -1
  6. package/lib/getRollupPlugins.js +5 -5
  7. package/lib/getRollupPlugins.js.map +1 -1
  8. package/lib/plugins/postcss/index.d.ts +3 -3
  9. package/lib/plugins/postcss/index.d.ts.map +1 -1
  10. package/lib/plugins/postcss/index.js +8 -520
  11. package/lib/plugins/postcss/index.js.map +1 -1
  12. package/lib/plugins/postcss/less-loader.d.ts +9 -0
  13. package/lib/plugins/postcss/less-loader.d.ts.map +1 -0
  14. package/lib/plugins/postcss/less-loader.js +36 -0
  15. package/lib/plugins/postcss/less-loader.js.map +1 -0
  16. package/lib/plugins/postcss/loaders.d.ts +26 -0
  17. package/lib/plugins/postcss/loaders.d.ts.map +1 -0
  18. package/lib/plugins/postcss/loaders.js +93 -0
  19. package/lib/plugins/postcss/loaders.js.map +1 -0
  20. package/lib/plugins/postcss/postcss-loader.d.ts +10 -0
  21. package/lib/plugins/postcss/postcss-loader.d.ts.map +1 -0
  22. package/lib/plugins/postcss/postcss-loader.js +168 -0
  23. package/lib/plugins/postcss/postcss-loader.js.map +1 -0
  24. package/lib/plugins/postcss/sass-loader.d.ts +9 -0
  25. package/lib/plugins/postcss/sass-loader.d.ts.map +1 -0
  26. package/lib/plugins/postcss/sass-loader.js +99 -0
  27. package/lib/plugins/postcss/sass-loader.js.map +1 -0
  28. package/lib/plugins/postcss/types.d.ts +42 -0
  29. package/lib/plugins/postcss/types.d.ts.map +1 -0
  30. package/lib/plugins/postcss/types.js +3 -0
  31. package/lib/plugins/postcss/types.js.map +1 -0
  32. package/lib/plugins/postcss/utils/humanlize-path.d.ts +3 -0
  33. package/lib/plugins/postcss/utils/humanlize-path.d.ts.map +1 -0
  34. package/lib/plugins/postcss/utils/humanlize-path.js +7 -0
  35. package/lib/plugins/postcss/utils/humanlize-path.js.map +1 -0
  36. package/lib/plugins/postcss/utils/load-module.d.ts +7 -0
  37. package/lib/plugins/postcss/utils/load-module.d.ts.map +1 -0
  38. package/lib/plugins/postcss/utils/load-module.js +27 -0
  39. package/lib/plugins/postcss/utils/load-module.js.map +1 -0
  40. package/lib/plugins/postcss/utils/normalize-path.d.ts +3 -0
  41. package/lib/plugins/postcss/utils/normalize-path.d.ts.map +1 -0
  42. package/lib/plugins/postcss/utils/normalize-path.js +4 -0
  43. package/lib/plugins/postcss/utils/normalize-path.js.map +1 -0
  44. package/lib/rollup.d.ts.map +1 -1
  45. package/lib/rollup.js +5 -3
  46. package/lib/rollup.js.map +1 -1
  47. package/package.json +10 -8
  48. package/lib/rollupCapabilities.d.ts +0 -7
  49. package/lib/rollupCapabilities.d.ts.map +0 -1
  50. package/lib/rollupCapabilities.js.map +0 -1
@@ -0,0 +1,99 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ import path from 'path';
4
+ import pify from 'pify';
5
+ import resolvePackage from 'resolve';
6
+ import PQueue from 'p-queue';
7
+ import { loadModule } from './utils/load-module.js';
8
+ // This queue makes sure node-sass leaves one thread available for executing fs tasks
9
+ // See: https://github.com/sass/node-sass/issues/857
10
+ const threadPoolSize = process.env.UV_THREADPOOL_SIZE || 4;
11
+ const workQueue = new PQueue({ concurrency: threadPoolSize - 1 });
12
+ const moduleRe = /^~([a-z\d]|@).+/i;
13
+ const getUrlOfPartial = (url) => {
14
+ const parsedUrl = path.parse(url);
15
+ return `${parsedUrl.dir}${path.sep}_${parsedUrl.base}`;
16
+ };
17
+ const resolvePromise = pify(resolvePackage);
18
+ // List of supported SASS modules in the order of preference
19
+ const sassModuleIds = ['sass', 'node-sass'];
20
+ /* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
21
+ export default {
22
+ name: 'sass',
23
+ test: /\.(sass|scss)$/,
24
+ process({ code }) {
25
+ return new Promise((resolve, reject) => {
26
+ (async () => {
27
+ const sassModule = await loadSassOrThrow();
28
+ // accessing sassModule.default logs an error in latest versions
29
+ const sass = sassModule.render ? sassModule : sassModule.default;
30
+ const render = pify(sass.render.bind(sass));
31
+ const data = this.options.data || '';
32
+ workQueue.add(() => render({
33
+ ...this.options,
34
+ file: this.id,
35
+ data: data + code,
36
+ indentedSyntax: /\.sass$/.test(this.id),
37
+ sourceMap: this.sourceMap,
38
+ importer: [
39
+ (url, importer, done) => {
40
+ if (!moduleRe.test(url))
41
+ return done({ file: url });
42
+ const moduleUrl = url.slice(1);
43
+ const partialUrl = getUrlOfPartial(moduleUrl);
44
+ const options = {
45
+ basedir: path.dirname(importer),
46
+ extensions: ['.scss', '.sass', '.css'],
47
+ };
48
+ const finishImport = (id) => {
49
+ done({
50
+ // Do not add `.css` extension in order to inline the file
51
+ file: id.endsWith('.css') ? id.replace(/\.css$/, '') : id,
52
+ });
53
+ };
54
+ const next = () => {
55
+ // Catch all resolving errors, return the original file and pass responsibility back to other custom importers
56
+ done({ file: url });
57
+ };
58
+ // Give precedence to importing a partial
59
+ resolvePromise(partialUrl, options)
60
+ .then(finishImport)
61
+ .catch((error) => {
62
+ if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ENOENT') {
63
+ resolvePromise(moduleUrl, options).then(finishImport).catch(next);
64
+ }
65
+ else {
66
+ next();
67
+ }
68
+ });
69
+ },
70
+ ].concat(this.options.importer || []),
71
+ })
72
+ .then((result) => {
73
+ for (const file of result.stats.includedFiles) {
74
+ this.dependencies.add(file);
75
+ }
76
+ resolve({
77
+ code: result.css.toString(),
78
+ map: result.map && result.map.toString(),
79
+ });
80
+ })
81
+ .catch(reject));
82
+ })();
83
+ });
84
+ },
85
+ };
86
+ async function loadSassOrThrow() {
87
+ // Loading one of the supported modules
88
+ for (const moduleId of sassModuleIds) {
89
+ const module = await loadModule(moduleId);
90
+ if (module) {
91
+ return module;
92
+ }
93
+ }
94
+ // Throwing exception if module can't be loaded
95
+ throw new Error(`You need to install one of the following packages: ${sassModuleIds
96
+ .map((moduleId) => `"${moduleId}"`)
97
+ .join(', ')} in order to process SASS files`);
98
+ }
99
+ //# sourceMappingURL=sass-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sass-loader.js","sourceRoot":"","sources":["../../../src/plugins/postcss/sass-loader.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc;AACd,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,cAAc,MAAM,SAAS,CAAC;AACrC,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,qFAAqF;AACrF,oDAAoD;AACpD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,CAAC;AAC3D,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,EAAE,WAAW,EAAE,cAAc,GAAG,CAAC,EAAE,CAAC,CAAC;AAElE,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAEpC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,EAAE;IAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,GAAG,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE5C,2EAA2E;AAC3E,eAAe;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,E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C,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;qBACzC,CAAC,CAAC;gBACL,CAAC,CAAC;qBACD,KAAK,CAAC,MAAM,CAAC,CACjB,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,KAAK,UAAU,eAAe;IAC5B,uCAAuC;IACvC,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,+CAA+C;IAC/C,MAAM,IAAI,KAAK,CACb,sDAAsD,aAAa;SAChE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,GAAG,CAAC;SAClC,IAAI,CAAC,IAAI,CAAC,iCAAiC,CAC/C,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable */\n// @ts-nocheck\nimport path from 'path';\nimport pify from 'pify';\nimport resolvePackage from 'resolve';\nimport PQueue from 'p-queue';\nimport { loadModule } from './utils/load-module.js';\n\n// This queue makes sure node-sass leaves one thread available for executing fs tasks\n// See: https://github.com/sass/node-sass/issues/857\nconst threadPoolSize = process.env.UV_THREADPOOL_SIZE || 4;\nconst workQueue = new PQueue({ concurrency: threadPoolSize - 1 });\n\nconst moduleRe = /^~([a-z\\d]|@).+/i;\n\nconst getUrlOfPartial = (url) => {\n const parsedUrl = path.parse(url);\n return `${parsedUrl.dir}${path.sep}_${parsedUrl.base}`;\n};\n\nconst resolvePromise = pify(resolvePackage);\n\n// List of supported SASS modules in the order of preference\nconst sassModuleIds = ['sass', 'node-sass'];\n\n/* eslint import/no-anonymous-default-export: [2, {\"allowObject\": true}] */\nexport default {\n name: 'sass',\n test: /\\.(sass|scss)$/,\n process({ code }) {\n return new Promise((resolve, reject) => {\n (async () => {\n const sassModule = await loadSassOrThrow();\n // accessing sassModule.default logs an error in latest versions\n const sass = sassModule.render ? sassModule : sassModule.default;\n const render = pify(sass.render.bind(sass));\n const data = this.options.data || '';\n workQueue.add(() =>\n render({\n ...this.options,\n file: this.id,\n data: data + code,\n indentedSyntax: /\\.sass$/.test(this.id),\n sourceMap: this.sourceMap,\n importer: [\n (url, importer, done) => {\n if (!moduleRe.test(url)) return done({ file: url });\n\n const moduleUrl = url.slice(1);\n const partialUrl = getUrlOfPartial(moduleUrl);\n\n const options = {\n basedir: path.dirname(importer),\n extensions: ['.scss', '.sass', '.css'],\n };\n const finishImport = (id) => {\n done({\n // Do not add `.css` extension in order to inline the file\n file: id.endsWith('.css') ? id.replace(/\\.css$/, '') : id,\n });\n };\n\n const next = () => {\n // Catch all resolving errors, return the original file and pass responsibility back to other custom importers\n done({ file: url });\n };\n\n // Give precedence to importing a partial\n resolvePromise(partialUrl, options)\n .then(finishImport)\n .catch((error) => {\n if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ENOENT') {\n resolvePromise(moduleUrl, options).then(finishImport).catch(next);\n } else {\n next();\n }\n });\n },\n ].concat(this.options.importer || []),\n })\n .then((result) => {\n for (const file of result.stats.includedFiles) {\n this.dependencies.add(file);\n }\n\n resolve({\n code: result.css.toString(),\n map: result.map && result.map.toString(),\n });\n })\n .catch(reject),\n );\n })();\n });\n },\n};\n\nasync function loadSassOrThrow() {\n // Loading one of the supported modules\n for (const moduleId of sassModuleIds) {\n const module = await loadModule(moduleId);\n if (module) {\n return module;\n }\n }\n\n // Throwing exception if module can't be loaded\n throw new Error(\n `You need to install one of the following packages: ${sassModuleIds\n .map((moduleId) => `\"${moduleId}\"`)\n .join(', ')} in order to process SASS files`,\n );\n}\n"]}
@@ -0,0 +1,42 @@
1
+ import type { CreateFilter } from '@rollup/pluginutils';
2
+ type FunctionType<T = any, U = any> = (...args: readonly T[]) => U;
3
+ type onExtract = (asset: Readonly<{
4
+ code: any;
5
+ map: any;
6
+ codeFileName: string;
7
+ mapFileName: string;
8
+ }>) => boolean;
9
+ export type PostCSSPluginConf = {
10
+ inject?: boolean | Record<string, any> | ((cssVariableName: string, id: string) => string);
11
+ extract?: boolean | string;
12
+ onExtract?: onExtract;
13
+ modules?: boolean | Record<string, any>;
14
+ extensions?: string[];
15
+ plugins?: any[];
16
+ autoModules?: boolean;
17
+ namedExports?: boolean | ((id: string) => string);
18
+ minimize?: boolean | any;
19
+ parser?: string | FunctionType;
20
+ stringifier?: string | FunctionType;
21
+ syntax?: string | FunctionType;
22
+ exec?: boolean;
23
+ config?: boolean | {
24
+ path: string;
25
+ ctx: any;
26
+ };
27
+ to?: string;
28
+ name?: any[] | any[][];
29
+ loaders?: any[];
30
+ onImport?: (id: string) => void;
31
+ use?: string[] | {
32
+ [key in 'sass' | 'less']: any;
33
+ };
34
+ /**
35
+ * @default: false
36
+ **/
37
+ sourceMap?: boolean | 'inline';
38
+ include?: Parameters<CreateFilter>[0];
39
+ exclude?: Parameters<CreateFilter>[1];
40
+ };
41
+ export {};
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/postcss/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,KAAK,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;AAEnE,KAAK,SAAS,GAAG,CACf,KAAK,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,KACC,OAAO,CAAC;AAEb,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,OAAO,GAAG,MAA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CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export {};
2
+ // export default function (options?: Readonly<PostCSSPluginConf>): Plugin;
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/postcss/types.ts"],"names":[],"mappings":";AA+CA,2EAA2E","sourcesContent":["/* eslint-disable */\nimport type { CreateFilter } from '@rollup/pluginutils';\n\ntype FunctionType<T = any, U = any> = (...args: readonly T[]) => U;\n\ntype onExtract = (\n asset: Readonly<{\n code: any;\n map: any;\n codeFileName: string;\n mapFileName: string;\n }>,\n) => boolean;\n\nexport type PostCSSPluginConf = {\n inject?: boolean | Record<string, any> | ((cssVariableName: string, id: string) => string);\n extract?: boolean | string;\n onExtract?: onExtract;\n modules?: boolean | Record<string, any>;\n extensions?: string[];\n plugins?: any[];\n autoModules?: boolean;\n namedExports?: boolean | ((id: string) => string);\n minimize?: boolean | any;\n parser?: string | FunctionType;\n stringifier?: string | FunctionType;\n syntax?: string | FunctionType;\n exec?: boolean;\n config?:\n | boolean\n | {\n path: string;\n ctx: any;\n };\n to?: string;\n name?: any[] | any[][];\n loaders?: any[];\n onImport?: (id: string) => void;\n use?: string[] | { [key in 'sass' | 'less']: any };\n /**\n * @default: false\n **/\n sourceMap?: boolean | 'inline';\n include?: Parameters<CreateFilter>[0];\n exclude?: Parameters<CreateFilter>[1];\n};\n\n// export default function (options?: Readonly<PostCSSPluginConf>): Plugin;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const humanlizePath: (filepath: any) => any;
2
+ export default humanlizePath;
3
+ //# sourceMappingURL=humanlize-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humanlize-path.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/humanlize-path.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,aAAa,GAAI,aAAQ,QAA0D,CAAC;AAE1F,eAAe,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ import path from 'path';
4
+ import normalizePath from './normalize-path.js';
5
+ const humanlizePath = (filepath) => normalizePath(path.relative(process.cwd(), filepath));
6
+ export default humanlizePath;
7
+ //# sourceMappingURL=humanlize-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humanlize-path.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/humanlize-path.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc;AACd,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE1F,eAAe,aAAa,CAAC","sourcesContent":["/* eslint-disable */\n// @ts-nocheck\nimport path from 'path';\nimport normalizePath from './normalize-path.js';\n\nconst humanlizePath = (filepath) => normalizePath(path.relative(process.cwd(), filepath));\n\nexport default humanlizePath;\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Load a module using modern ESM dynamic imports
3
+ * @param {string} moduleId - The module to load
4
+ * @returns {Promise<any>} The loaded module
5
+ */
6
+ export declare function loadModule(moduleId: any): Promise<any>;
7
+ //# sourceMappingURL=load-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-module.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/load-module.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,QAAQ,KAAA,gBAcxC"}
@@ -0,0 +1,27 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ import { createRequire } from 'module';
4
+ const require = createRequire(import.meta.url);
5
+ /**
6
+ * Load a module using modern ESM dynamic imports
7
+ * @param {string} moduleId - The module to load
8
+ * @returns {Promise<any>} The loaded module
9
+ */
10
+ export async function loadModule(moduleId) {
11
+ try {
12
+ // Try to import the module directly
13
+ return await import(moduleId);
14
+ }
15
+ catch {
16
+ // If direct import fails, try resolving from current working directory
17
+ try {
18
+ const resolvedPath = require.resolve(moduleId);
19
+ return await import(resolvedPath);
20
+ }
21
+ catch {
22
+ // Return null if module cannot be loaded
23
+ return null;
24
+ }
25
+ }
26
+ }
27
+ //# sourceMappingURL=load-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-module.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/load-module.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc;AACd,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAQ;IACvC,IAAI,CAAC;QACH,oCAAoC;QACpC,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;QACvE,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC/C,OAAO,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,yCAAyC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable */\n// @ts-nocheck\nimport { createRequire } from 'module';\n\nconst require = createRequire(import.meta.url);\n\n/**\n * Load a module using modern ESM dynamic imports\n * @param {string} moduleId - The module to load\n * @returns {Promise<any>} The loaded module\n */\nexport async function loadModule(moduleId) {\n try {\n // Try to import the module directly\n return await import(moduleId);\n } catch {\n // If direct import fails, try resolving from current working directory\n try {\n const resolvedPath = require.resolve(moduleId);\n return await import(resolvedPath);\n } catch {\n // Return null if module cannot be loaded\n return null;\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: (path: any) => any;
2
+ export default _default;
3
+ //# sourceMappingURL=normalize-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/normalize-path.ts"],"names":[],"mappings":"yBAEgB,SAAI;AAApB,wBAA2D"}
@@ -0,0 +1,4 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ export default (path) => path && path.replace(/\\+/g, '/');
4
+ //# sourceMappingURL=normalize-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-path.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/normalize-path.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc;AACd,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC","sourcesContent":["/* eslint-disable */\n// @ts-nocheck\nexport default (path) => path && path.replace(/\\\\+/g, '/');\n"]}
@@ -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,OAuDpB,CAAC"}
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,8 +4,8 @@ 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 { rollupCapabilities } from './rollupCapabilities.js';
8
- import { base64AssetExtensions } from '@ms-cloudpack/bundler-utilities';
7
+ import { getRollupCapabilities } from './getRollupCapabilities.js';
8
+ import { base64AssetExtensions } from '@ms-cloudpack/path-utilities';
9
9
  const bundlerName = 'rollup';
10
10
  export const rollup = {
11
11
  name: bundlerName,
@@ -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: rollupCapabilities,
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,mBA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,\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 { rollupCapabilities } from './rollupCapabilities.js';\nimport { base64AssetExtensions } from '@ms-cloudpack/bundler-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 ...(options.bundlerCapabilities || {}),\n } satisfies InternalBundlerCapabilitiesOptions;\n\n const { inputOptions, outputOptions } = await processCapabilities<RollupCapabilityConfig>({\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
+ {"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,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,MAAM,WAAW,GAAG,QAAQ,CAAC;AAE7B,MAAM,CAAC,MAAM,MAAM,GAAY;IAC7B,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,KAAK,WAAW,OAAO,EAAE,OAAO;QACtC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACpE,IAAI,MAAM,EAAE,MAAM,EAAE,CAAC;YACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;QAEvF,MAAM,0BAA0B,GAA+B;YAC7D,cAAc,EAAE,EAAE,UAAU,EAAE,qBA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AE,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 {\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.1",
3
+ "version": "0.6.3",
4
4
  "description": "Cloudpack's wrapper for the Rollup bundler",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,13 +25,14 @@
25
25
  "prepack": "cp .npmignore lib/.npmignore"
26
26
  },
27
27
  "dependencies": {
28
- "@ms-cloudpack/bundler-capabilities": "^0.4.8",
29
- "@ms-cloudpack/bundler-utilities": "^0.7.5",
30
- "@ms-cloudpack/common-types": "^0.33.0",
31
- "@ms-cloudpack/esm-stub-utilities": "^0.15.34",
32
- "@ms-cloudpack/package-utilities": "^13.2.4",
28
+ "@ms-cloudpack/bundler-capabilities": "^0.5.0",
29
+ "@ms-cloudpack/bundler-utilities": "^0.8.0",
30
+ "@ms-cloudpack/common-types": "^0.33.1",
31
+ "@ms-cloudpack/common-types-browser": "^0.6.4",
32
+ "@ms-cloudpack/esm-stub-utilities": "^0.15.35",
33
+ "@ms-cloudpack/package-utilities": "^13.2.5",
33
34
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
34
- "@ms-cloudpack/path-utilities": "^3.2.1",
35
+ "@ms-cloudpack/path-utilities": "^3.2.2",
35
36
  "@rollup/plugin-alias": "^5.0.1",
36
37
  "@rollup/plugin-commonjs": "^28.0.4",
37
38
  "@rollup/plugin-dynamic-import-vars": "^2.0.0",
@@ -46,13 +47,14 @@
46
47
  "concat-with-sourcemaps": "^1.1.0",
47
48
  "cssnano": "^6.0.0",
48
49
  "magic-string": "^0.30.5",
49
- "p-queue": "^8.0.1",
50
+ "p-queue": "^9.0.0",
50
51
  "pify": "^6.0.0",
51
52
  "postcss": "^8.0.0",
52
53
  "postcss-modules": "^6.0.0",
53
54
  "resolve": "^1.22.0",
54
55
  "rollup": "^4.0.0",
55
56
  "rollup-plugin-polyfill-node": "^0.13.0",
57
+ "safe-identifier": "^0.4.2",
56
58
  "sass": "^1.0.0",
57
59
  "style-inject": "^0.3.0"
58
60
  },
@@ -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/rollupCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAU,aAAa,EAAE,MAAM,QAAQ,CAAC;AAqBnE,eAAO,MAAM,kBAAkB,EAAE,wCAAwC,CAAC;IACxE,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAqCA,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"rollupCapabilities.js","sourceRoot":"","sources":["../src/rollupCapabilities.ts"],"names":[],"mappings":"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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"]}