@ms-cloudpack/bundler-rollup 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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,
|
|
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,CAkED"}
|
package/lib/getRollupOptions.js
CHANGED
|
@@ -20,7 +20,15 @@ export async function getRollupOptions(params) {
|
|
|
20
20
|
return {
|
|
21
21
|
warnings,
|
|
22
22
|
inputOptions: {
|
|
23
|
-
external: (id) => shouldExternalizePackage({
|
|
23
|
+
external: (id, parent) => shouldExternalizePackage({
|
|
24
|
+
inputPath,
|
|
25
|
+
id,
|
|
26
|
+
parent,
|
|
27
|
+
inlined,
|
|
28
|
+
external,
|
|
29
|
+
polyfills,
|
|
30
|
+
shouldInlineNodeBuiltins: true,
|
|
31
|
+
}),
|
|
24
32
|
...bundlerOptions.inputOptions,
|
|
25
33
|
// Don't allow overriding the options below
|
|
26
34
|
// Rollup requires entry keys without a leading ./
|
|
@@ -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,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACvC,MAAM,EACJ,SAAS,EACT,MAA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,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;YACZ,cAAc,EAAE,WAAW;YAC3B,cAAc,EAAE,WAAW;YAC3B,cAAc,EAAE,yBAAyB;YACzC,6EAA6E;YAC7E,wEAAwE;YACxE,mFAAmF;YACnF,sBAAsB,EAAE,CAAC,kBAAkB,EAAE,aAAa,EAAE,EAAE;YAC5D,8DAA8D;YAC9D,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC,CAAC;SACxG;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, parent) =>\n shouldExternalizePackage({\n inputPath,\n id,\n parent,\n inlined,\n external,\n polyfills,\n shouldInlineNodeBuiltins: true,\n }),\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 entryFileNames: '[name].js',\n chunkFileNames: '[name].js',\n assetFileNames: 'assets/[name]-[extname]',\n // This is a fix so that the sourcemaps never include the hash in their path,\n // as that invalidates the sourcemap on change and removes break points.\n // ../../../../relative/path/to/src/path/to/file.ts -> rollup://src/path/to/file.ts\n sourcemapPathTransform: (relativeSourcePath, sourcemapPath) =>\n // No need to normalize the path as rollup will do that for us\n 'rollup://' + path.relative(inputPath, path.resolve(path.dirname(sourcemapPath), relativeSourcePath)),\n },\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-rollup",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "A cloudpack plugin for abstracting rollup.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ms-cloudpack/bundler-capabilities": "^0.2.
|
|
23
|
-
"@ms-cloudpack/bundler-utilities": "^0.
|
|
22
|
+
"@ms-cloudpack/bundler-capabilities": "^0.2.23",
|
|
23
|
+
"@ms-cloudpack/bundler-utilities": "^0.3.1",
|
|
24
24
|
"@ms-cloudpack/common-types": "^0.24.17",
|
|
25
|
-
"@ms-cloudpack/esm-stub-utilities": "^0.14.
|
|
26
|
-
"@ms-cloudpack/package-utilities": "^12.3.
|
|
25
|
+
"@ms-cloudpack/esm-stub-utilities": "^0.14.30",
|
|
26
|
+
"@ms-cloudpack/package-utilities": "^12.3.6",
|
|
27
27
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
28
28
|
"@ms-cloudpack/path-utilities": "^3.1.2",
|
|
29
29
|
"@rollup/plugin-dynamic-import-vars": "^2.0.0",
|