@ms-cloudpack/bundler-rollup 0.2.16 → 0.2.17

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":"getRollupOptions.d.ts","sourceRoot":"","sources":["../src/getRollupOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAI5E,OAAO,KAAK,EAAgB,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAUpF;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE;IACN,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;CACzC,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,GAC1C,OAAO,CAAC;IACT,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB,CAAC,CAsCD"}
1
+ {"version":3,"file":"getRollupOptions.d.ts","sourceRoot":"","sources":["../src/getRollupOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAI5E,OAAO,KAAK,EAAgB,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAUpF;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE;IACN,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;CACzC,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,GAC1C,OAAO,CAAC;IACT,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB,CAAC,CAgDD"}
@@ -13,7 +13,7 @@ const ignoredWarnings = ['Circular dependency:'];
13
13
  */
14
14
  export async function getRollupOptions(params) {
15
15
  const { options, newEntries } = params;
16
- const { inputPath, minify, external = [], inlined = [], bundlerOptions = {}, dynamicImports, sourcemap } = options;
16
+ const { inputPath, minify, external = [], inlined = [], bundlerOptions = {}, dynamicImports, sourcemap, bundlerCapabilities, } = options;
17
17
  const isExternal = isExternalPackage(inputPath);
18
18
  const enableTypescript = !isExternal && fs.existsSync(path.resolve(inputPath, 'tsconfig.json'));
19
19
  const warnings = [];
@@ -32,6 +32,7 @@ export async function getRollupOptions(params) {
32
32
  enableTypescript,
33
33
  dynamicImports,
34
34
  sourcemap,
35
+ resolveWebExtensions: !!bundlerCapabilities?.['resolve-web-extensions'],
35
36
  }),
36
37
  onwarn: (warning) => {
37
38
  if (!ignoredWarnings.some((ignored) => warning.message.includes(ignored))) {
@@ -1 +1 @@
1
- {"version":3,"file":"getRollupOptions.js","sourceRoot":"","sources":["../src/getRollupOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,wFAAwF;AACxF,mDAAmD;AACnD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AAEnE,yCAAyC;AACzC,MAAM,eAAe,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAE2C;IAO3C,MAAM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AAO,CAAC,CAAC,EAAE,CAAC;oBAC1E,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;SACF;QACD,aAAa,EAAE;YACb,SAAS;YACT,GAAI,cAAc,CAAC,aAA+B;YAClD,8BAA8B;YAC9B,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;YACjF,MAAM,EAAE,IAAI;SACb;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { shouldExternalizePackage } from '@ms-cloudpack/bundler-utilities';\nimport type { BundleOptions } from '@ms-cloudpack/common-types';\nimport type { WriteESMStubsResult } from '@ms-cloudpack/esm-stub-utilities';\nimport { isExternalPackage } from '@ms-cloudpack/path-utilities';\nimport fs from 'fs';\nimport path from 'path';\nimport type { InputOptions, OutputOptions, RollupLog, RollupOptions } from 'rollup';\nimport { getRollupPlugins } from './getRollupPlugins.js';\n\n// These are the polyfills that we support from the 'rollup-plugin-polyfill-node' plugin\n// that are not included in the node builtins list.\nconst polyfills = new Set(['global', '_inherits', '_buffer_list']);\n\n// Spammy, usually non-actionable warning\nconst ignoredWarnings = ['Circular dependency:'];\n\n/**\n * Converts BundlerOptions to Rollup-specific options.\n */\nexport async function getRollupOptions(\n params: {\n options: Omit<BundleOptions, 'entries'>;\n } & Pick<WriteESMStubsResult, 'newEntries'>,\n): Promise<{\n inputOptions: RollupOptions;\n outputOptions: OutputOptions;\n /** Warnings will be pushed to this array (rollup handles warnings with a callback) */\n warnings: RollupLog[];\n}> {\n const { options, newEntries } = params;\n const { inputPath, minify, external = [], inlined = [], bundlerOptions = {}, dynamicImports, sourcemap } = options;\n const isExternal = isExternalPackage(inputPath);\n const enableTypescript = !isExternal && fs.existsSync(path.resolve(inputPath, 'tsconfig.json'));\n const warnings: RollupLog[] = [];\n\n return {\n warnings,\n inputOptions: {\n external: (id) => shouldExternalizePackage({ id, inlined, external, polyfills, shouldInlineNodeBuiltins: true }),\n ...(bundlerOptions.inputOptions as InputOptions),\n // Don't allow overriding the options below\n\n // Rollup requires entry keys without a leading ./\n input: Object.fromEntries(Object.entries(newEntries).map(([key, value]) => [key.replace(/^\\.\\//, ''), value])),\n // These are not possible to override properly via JSON config\n plugins: await getRollupPlugins({\n isProduction: minify,\n packagePath: inputPath,\n enableTypescript,\n dynamicImports,\n sourcemap,\n }),\n onwarn: (warning) => {\n if (!ignoredWarnings.some((ignored) => warning.message.includes(ignored))) {\n warnings.push(warning);\n }\n },\n },\n outputOptions: {\n sourcemap,\n ...(bundlerOptions.outputOptions as OutputOptions),\n // No overriding these options\n dir: options.outputPath ? path.resolve(inputPath, options.outputPath) : inputPath,\n format: 'es',\n },\n };\n}\n"]}
1
+ {"version":3,"file":"getRollupOptions.js","sourceRoot":"","sources":["../src/getRollupOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,wFAAwF;AACxF,mDAAmD;AACnD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AAEnE,yCAAyC;AACzC,MAAM,eAAe,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAE2C;IAO3C,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACvC,MAAM,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,GAAG,EAAE,EACb,OAAO,GAAG,EAAE,EACZ,cAA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AAO,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;SACF;QACD,aAAa,EAAE;YACb,SAAS;YACT,GAAI,cAAc,CAAC,aAA+B;YAClD,8BAA8B;YAC9B,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;YACjF,MAAM,EAAE,IAAI;SACb;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { shouldExternalizePackage } from '@ms-cloudpack/bundler-utilities';\nimport type { BundleOptions } from '@ms-cloudpack/common-types';\nimport type { WriteESMStubsResult } from '@ms-cloudpack/esm-stub-utilities';\nimport { isExternalPackage } from '@ms-cloudpack/path-utilities';\nimport fs from 'fs';\nimport path from 'path';\nimport type { InputOptions, OutputOptions, RollupLog, RollupOptions } from 'rollup';\nimport { getRollupPlugins } from './getRollupPlugins.js';\n\n// These are the polyfills that we support from the 'rollup-plugin-polyfill-node' plugin\n// that are not included in the node builtins list.\nconst polyfills = new Set(['global', '_inherits', '_buffer_list']);\n\n// Spammy, usually non-actionable warning\nconst ignoredWarnings = ['Circular dependency:'];\n\n/**\n * Converts BundlerOptions to Rollup-specific options.\n */\nexport async function getRollupOptions(\n params: {\n options: Omit<BundleOptions, 'entries'>;\n } & Pick<WriteESMStubsResult, 'newEntries'>,\n): Promise<{\n inputOptions: RollupOptions;\n outputOptions: OutputOptions;\n /** Warnings will be pushed to this array (rollup handles warnings with a callback) */\n warnings: RollupLog[];\n}> {\n const { options, newEntries } = params;\n const {\n inputPath,\n minify,\n external = [],\n inlined = [],\n bundlerOptions = {},\n dynamicImports,\n sourcemap,\n bundlerCapabilities,\n } = options;\n const isExternal = isExternalPackage(inputPath);\n const enableTypescript = !isExternal && fs.existsSync(path.resolve(inputPath, 'tsconfig.json'));\n const warnings: RollupLog[] = [];\n\n return {\n warnings,\n inputOptions: {\n external: (id) => shouldExternalizePackage({ id, inlined, external, polyfills, shouldInlineNodeBuiltins: true }),\n ...(bundlerOptions.inputOptions as InputOptions),\n // Don't allow overriding the options below\n\n // Rollup requires entry keys without a leading ./\n input: Object.fromEntries(Object.entries(newEntries).map(([key, value]) => [key.replace(/^\\.\\//, ''), value])),\n // These are not possible to override properly via JSON config\n plugins: await getRollupPlugins({\n isProduction: minify,\n packagePath: inputPath,\n enableTypescript,\n dynamicImports,\n sourcemap,\n resolveWebExtensions: !!bundlerCapabilities?.['resolve-web-extensions'],\n }),\n onwarn: (warning) => {\n if (!ignoredWarnings.some((ignored) => warning.message.includes(ignored))) {\n warnings.push(warning);\n }\n },\n },\n outputOptions: {\n sourcemap,\n ...(bundlerOptions.outputOptions as OutputOptions),\n // No overriding these options\n dir: options.outputPath ? path.resolve(inputPath, options.outputPath) : inputPath,\n format: 'es',\n },\n };\n}\n"]}
@@ -5,5 +5,6 @@ export declare function getRollupPlugins(options: {
5
5
  enableTypescript?: boolean;
6
6
  dynamicImports?: string[];
7
7
  sourcemap: boolean | undefined;
8
+ resolveWebExtensions: boolean;
8
9
  }): Promise<Plugin[]>;
9
10
  //# sourceMappingURL=getRollupPlugins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRollupPlugins.d.ts","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAqBrC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA+EpB"}
1
+ {"version":3,"file":"getRollupPlugins.d.ts","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAqBrC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,oBAAoB,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsFpB"}
@@ -22,7 +22,7 @@ function getSwcPlugin() {
22
22
  return import('@rollup/plugin-swc').then((m) => m.default);
23
23
  }
24
24
  export async function getRollupPlugins(options) {
25
- const { isProduction, packagePath, enableTypescript, dynamicImports = [], sourcemap } = options;
25
+ const { isProduction, packagePath, enableTypescript, dynamicImports = [], sourcemap, resolveWebExtensions } = options;
26
26
  const swcConfigsForTs = enableTypescript ? getSwcConfig({ packagePath, sourcemap }) : undefined;
27
27
  return [
28
28
  // Used to replaces constants in the code.
@@ -55,7 +55,14 @@ export async function getRollupPlugins(options) {
55
55
  nodeResolve({
56
56
  preferBuiltins: false,
57
57
  browser: true,
58
- extensions: ['.js', '.json', ...(enableTypescript ? ['.ts', '.tsx'] : [])],
58
+ // TODO: Align with other bundlers https://github.com/microsoft/cloudpack/issues/2687
59
+ extensions: [
60
+ ...(resolveWebExtensions ? ['.web.js'] : []),
61
+ '.js',
62
+ '.json',
63
+ ...(enableTypescript && resolveWebExtensions ? ['.web.ts', '.web.tsx'] : []),
64
+ ...(enableTypescript ? ['.ts', '.tsx'] : []),
65
+ ],
59
66
  }),
60
67
  // Used to browserify node globals (process, global, etc.)
61
68
  nodePolyfills(),
@@ -1 +1 @@
1
- {"version":3,"file":"getRollupPlugins.js","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EA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CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;aACxF;SACF,CAAC;QAEF,2CAA2C;QAC3C,CAAC,CAAC,YAAY,IAAI,MAAM,EAAE;KAC3B,CAAC,MAAM,CAAC,CAAC,MAAM,EAAoB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { getSwcConfig } from '@ms-cloudpack/bundler-utilities';\nimport _dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';\nimport _json from '@rollup/plugin-json';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport _replace from '@rollup/plugin-replace';\nimport type _swc from '@rollup/plugin-swc';\nimport _terser from '@rollup/plugin-terser';\nimport type { Plugin } from 'rollup';\nimport _nodePolyfills from 'rollup-plugin-polyfill-node';\nimport _postcss from 'rollup-plugin-postcss';\nimport commonjs from './plugins/commonjs/index.js';\nimport { normalizeRequireStatements } from './plugins/normalizeRequireStatements.js';\n\n// Workaround for https://github.com/microsoft/TypeScript/issues/49189#issuecomment-1137756847\n// (https://arethetypeswrong.github.io/?p=%40rollup%2Fplugin-replace%405.0.2)\n// At runtime, we should always be using the ESM version of these packages, which use `export default`.\n// However, typescript interprets the types as CJS modules with a `default` property (which will fail at runtime).\nconst json = _json as unknown as typeof _json.default;\nconst replace = _replace as unknown as typeof _replace.default;\nconst terser = _terser as unknown as typeof _terser.default;\nconst nodePolyfills = _nodePolyfills as unknown as typeof _nodePolyfills.default;\nconst postcss = _postcss as unknown as typeof _postcss.default;\nconst dynamicImportVariables = _dynamicImportVariables as unknown as typeof _dynamicImportVariables.default;\n\nfunction getSwcPlugin() {\n return import('@rollup/plugin-swc').then((m) => m.default) as Promise<typeof _swc.default>;\n}\n\nexport async function getRollupPlugins(options: {\n isProduction?: boolean;\n packagePath: string;\n enableTypescript?: boolean;\n dynamicImports?: string[];\n sourcemap: boolean | undefined;\n}): Promise<Plugin[]> {\n const { isProduction, packagePath, enableTypescript, dynamicImports = [], sourcemap } = options;\n\n const swcConfigsForTs = enableTypescript ? getSwcConfig({ packagePath, sourcemap }) : undefined;\n\n return [\n // Used to replaces constants in the code.\n replace({\n values: {\n 'process.env.NODE_ENV': isProduction ? `\"production\"` : `\"development\"`,\n DEPRECATED_UNIT_TEST: 'true',\n },\n preventAssignment: true,\n }),\n\n normalizeRequireStatements(),\n\n postcss({\n modules: {\n globalModulePaths: [/global\\.css$/],\n },\n }),\n\n // Used to parse commonjs.\n commonjs({\n // Treat all dependencies as external esm modules (since we'll be bundling them.)\n esmExternals: true,\n\n // When __esModule is true, the default export is `exports.default`; otherwise it's `module.exports`.\n defaultIsModuleExports: true,\n\n // Convert `require('library')` to `import * as library from 'library'` always, because `import library from\n // 'library' risks runtime failure if the dependency is ESM that doesn't export a default.\n requireReturnsDefault: false,\n }),\n\n // Used to compile json files into javascript exports.\n json(),\n\n // // Used to resolve node_modules.\n nodeResolve({\n preferBuiltins: false,\n browser: true,\n extensions: ['.js', '.json', ...(enableTypescript ? ['.ts', '.tsx'] : [])],\n }),\n\n // Used to browserify node globals (process, global, etc.)\n nodePolyfills(),\n\n // The rollup swc plugin gets confused by angle bracket casts like `const x = <T>value;`\n // in .ts files if the tsx option is enabled, so use separate rules for .ts and .tsx files.\n // https://github.com/microsoft/cloudpack/pull/2555\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsOnly,\n include: /\\.ts$/,\n }),\n\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsx,\n include: /\\.tsx$/,\n }),\n\n // Only run this plugin on **/*.dynamic.* files (plus others as specified) to avoid an extra\n // parsing/processing step on all files.\n // Must be done AFTER the TS step because it can only handle JS syntax.\n dynamicImportVariables({\n include: [\n '**/*.dynamic.*',\n // Convert the dynamic imports options to globs starting with **\n // (the plugin seems to be matching against full paths)\n ...dynamicImports.map((d) => (d.startsWith('**/') ? d : d.replace(/^(\\.?\\/)?/, '**/'))),\n ],\n }),\n\n // Minify production builds as a last step.\n !!isProduction && terser(),\n ].filter((plugin): plugin is Plugin => !!plugin);\n}\n"]}
1
+ {"version":3,"file":"getRollupPlugins.js","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAE5C,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,QAAQ,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,8FAA8F;AAC9F,6EAA6E;AAC7E,uGAAuG;AACvG,kHAAkH;AAClH,MAAM,IAAI,GAAG,KAAwC,CAAC;AACtD,MAAM,OAAO,GAAG,QAA8C,CAAC;AAC/D,MAAM,MAAM,GAAG,OAA4C,CAAC;AAC5D,MAAM,aAAa,GAAG,cAA0D,CAAC;AACjF,MAAM,OAAO,GAAG,QAA8C,CAAC;AAC/D,MAAM,sBAAsB,GAAG,uBAA4E,CAAC;AAE5G,SAAS,YAAY;IACnB,OAAO,MAAM,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAiC,CAAC;AAC7F,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAOtC;IACC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,GAAG,EAAE,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,wFAAwF;QACxF,2FAA2F;QAC3F,mDAAmD;QACnD,eAAe;YACb,CAAC,MAAM,YAAY,EAAE,CAAC,CAAC;gBACrB,GAAG,EAAE,eAAe,CAAC,MAAM;gBAC3B,OAAO,EAAE,OAAO;aACjB,CAAC;QAEJ,eAAe;YACb,CAAC,MAAM,YAAY,EAAE,CAAC,CAAC;gBACrB,GAAG,EAAE,eAAe,CAAC,GAAG;gBACxB,OAAO,EAAE,QAAQ;aAClB,CAAC;QAEJ,4FAA4F;QAC5F,wCAAwC;QACxC,uEAAuE;QACvE,sBAAsB,CAAC;YACrB,OAAO,EAAE;gBACP,gBAAgB;gBAChB,gEAAgE;gBAChE,uDAAuD;gBACvD,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;aACxF;SACF,CAAC;QAEF,2CAA2C;QAC3C,CAAC,CAAC,YAAY,IAAI,MAAM,EAAE;KAC3B,CAAC,MAAM,CAAC,CAAC,MAAM,EAAoB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { getSwcConfig } from '@ms-cloudpack/bundler-utilities';\nimport _dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';\nimport _json from '@rollup/plugin-json';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport _replace from '@rollup/plugin-replace';\nimport type _swc from '@rollup/plugin-swc';\nimport _terser from '@rollup/plugin-terser';\nimport type { Plugin } from 'rollup';\nimport _nodePolyfills from 'rollup-plugin-polyfill-node';\nimport _postcss from 'rollup-plugin-postcss';\nimport commonjs from './plugins/commonjs/index.js';\nimport { normalizeRequireStatements } from './plugins/normalizeRequireStatements.js';\n\n// Workaround for https://github.com/microsoft/TypeScript/issues/49189#issuecomment-1137756847\n// (https://arethetypeswrong.github.io/?p=%40rollup%2Fplugin-replace%405.0.2)\n// At runtime, we should always be using the ESM version of these packages, which use `export default`.\n// However, typescript interprets the types as CJS modules with a `default` property (which will fail at runtime).\nconst json = _json as unknown as typeof _json.default;\nconst replace = _replace as unknown as typeof _replace.default;\nconst terser = _terser as unknown as typeof _terser.default;\nconst nodePolyfills = _nodePolyfills as unknown as typeof _nodePolyfills.default;\nconst postcss = _postcss as unknown as typeof _postcss.default;\nconst dynamicImportVariables = _dynamicImportVariables as unknown as typeof _dynamicImportVariables.default;\n\nfunction getSwcPlugin() {\n return import('@rollup/plugin-swc').then((m) => m.default) as Promise<typeof _swc.default>;\n}\n\nexport async function getRollupPlugins(options: {\n isProduction?: boolean;\n packagePath: string;\n enableTypescript?: boolean;\n dynamicImports?: string[];\n sourcemap: boolean | undefined;\n resolveWebExtensions: boolean;\n}): Promise<Plugin[]> {\n const { isProduction, packagePath, enableTypescript, dynamicImports = [], sourcemap, resolveWebExtensions } = options;\n\n const swcConfigsForTs = enableTypescript ? getSwcConfig({ packagePath, sourcemap }) : undefined;\n\n return [\n // Used to replaces constants in the code.\n replace({\n values: {\n 'process.env.NODE_ENV': isProduction ? `\"production\"` : `\"development\"`,\n DEPRECATED_UNIT_TEST: 'true',\n },\n preventAssignment: true,\n }),\n\n normalizeRequireStatements(),\n\n postcss({\n modules: {\n globalModulePaths: [/global\\.css$/],\n },\n }),\n\n // Used to parse commonjs.\n commonjs({\n // Treat all dependencies as external esm modules (since we'll be bundling them.)\n esmExternals: true,\n\n // When __esModule is true, the default export is `exports.default`; otherwise it's `module.exports`.\n defaultIsModuleExports: true,\n\n // Convert `require('library')` to `import * as library from 'library'` always, because `import library from\n // 'library' risks runtime failure if the dependency is ESM that doesn't export a default.\n requireReturnsDefault: false,\n }),\n\n // Used to compile json files into javascript exports.\n json(),\n\n // // Used to resolve node_modules.\n nodeResolve({\n preferBuiltins: false,\n browser: true,\n // TODO: Align with other bundlers https://github.com/microsoft/cloudpack/issues/2687\n extensions: [\n ...(resolveWebExtensions ? ['.web.js'] : []),\n '.js',\n '.json',\n ...(enableTypescript && resolveWebExtensions ? ['.web.ts', '.web.tsx'] : []),\n ...(enableTypescript ? ['.ts', '.tsx'] : []),\n ],\n }),\n\n // Used to browserify node globals (process, global, etc.)\n nodePolyfills(),\n\n // The rollup swc plugin gets confused by angle bracket casts like `const x = <T>value;`\n // in .ts files if the tsx option is enabled, so use separate rules for .ts and .tsx files.\n // https://github.com/microsoft/cloudpack/pull/2555\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsOnly,\n include: /\\.ts$/,\n }),\n\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsx,\n include: /\\.tsx$/,\n }),\n\n // Only run this plugin on **/*.dynamic.* files (plus others as specified) to avoid an extra\n // parsing/processing step on all files.\n // Must be done AFTER the TS step because it can only handle JS syntax.\n dynamicImportVariables({\n include: [\n '**/*.dynamic.*',\n // Convert the dynamic imports options to globs starting with **\n // (the plugin seems to be matching against full paths)\n ...dynamicImports.map((d) => (d.startsWith('**/') ? d : d.replace(/^(\\.?\\/)?/, '**/'))),\n ],\n }),\n\n // Minify production builds as a last step.\n !!isProduction && terser(),\n ].filter((plugin): plugin is Plugin => !!plugin);\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,CA0BA,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,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"}
@@ -23,6 +23,8 @@ export const rollupCapabilities = {
23
23
  config.outputOptions.paths = mergeObjects([config.outputOptions.paths || {}, options]);
24
24
  return config;
25
25
  },
26
+ // This is just a placeholder for the resolve-web-extensions capability. It is handled in getRollupPlugins.ts.
27
+ 'resolve-web-extensions': (config) => config,
26
28
  // This is a placeholder for the density capability. It doesn't do anything in the bundler.
27
29
  // It's just a workaround for a post-bundle task. This will be replaced with 'plugins' in the future.
28
30
  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,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 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;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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/bundler-rollup",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "A cloudpack plugin for abstracting rollup.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,13 +19,13 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@ms-cloudpack/bundler-capabilities": "^0.2.14",
23
- "@ms-cloudpack/bundler-utilities": "^0.2.3",
24
- "@ms-cloudpack/common-types": "^0.24.9",
25
- "@ms-cloudpack/esm-stub-utilities": "^0.14.10",
26
- "@ms-cloudpack/package-utilities": "^11.3.6",
22
+ "@ms-cloudpack/bundler-capabilities": "^0.2.15",
23
+ "@ms-cloudpack/bundler-utilities": "^0.2.4",
24
+ "@ms-cloudpack/common-types": "^0.24.10",
25
+ "@ms-cloudpack/esm-stub-utilities": "^0.14.11",
26
+ "@ms-cloudpack/package-utilities": "^12.0.0",
27
27
  "@ms-cloudpack/path-string-parsing": "^1.2.6",
28
- "@ms-cloudpack/path-utilities": "^3.0.6",
28
+ "@ms-cloudpack/path-utilities": "^3.0.7",
29
29
  "@rollup/plugin-dynamic-import-vars": "^2.0.0",
30
30
  "@rollup/plugin-json": "^6.0.0",
31
31
  "@rollup/plugin-node-resolve": "^15.0.0",