@ms-cloudpack/bundler-rollup 0.1.13 → 0.2.0
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/getRollupPlugins.d.ts.map +1 -1
- package/lib/getRollupPlugins.js +0 -3
- package/lib/getRollupPlugins.js.map +1 -1
- package/lib/rollup.d.ts.map +1 -1
- package/lib/rollup.js +20 -3
- package/lib/rollup.js.map +1 -1
- package/lib/rollupCapabilities.d.ts +7 -0
- package/lib/rollupCapabilities.d.ts.map +1 -0
- package/lib/rollupCapabilities.js +26 -0
- package/lib/rollupCapabilities.js.map +1 -0
- package/package.json +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRollupPlugins.d.ts","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"
|
|
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,CAmEpB"}
|
package/lib/getRollupPlugins.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getSwcConfig } from '@ms-cloudpack/bundler-utilities';
|
|
2
2
|
import _dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';
|
|
3
|
-
import _image from '@rollup/plugin-image';
|
|
4
3
|
import _json from '@rollup/plugin-json';
|
|
5
4
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
6
5
|
import _replace from '@rollup/plugin-replace';
|
|
@@ -18,7 +17,6 @@ const replace = _replace;
|
|
|
18
17
|
const terser = _terser;
|
|
19
18
|
const nodePolyfills = _nodePolyfills;
|
|
20
19
|
const postcss = _postcss;
|
|
21
|
-
const image = _image;
|
|
22
20
|
const dynamicImportVariables = _dynamicImportVariables;
|
|
23
21
|
function getSwcPlugin() {
|
|
24
22
|
return import('@rollup/plugin-swc').then((m) => m.default);
|
|
@@ -60,7 +58,6 @@ export async function getRollupPlugins(options) {
|
|
|
60
58
|
}),
|
|
61
59
|
// Used to browserify node globals (process, global, etc.)
|
|
62
60
|
nodePolyfills(),
|
|
63
|
-
image(),
|
|
64
61
|
enableTypescript &&
|
|
65
62
|
(await getSwcPlugin())({
|
|
66
63
|
swc: getSwcConfig({ packagePath, sourcemap }).ts,
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,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AAU,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC3E,CAAC;QAEF,0DAA0D;QAC1D,aAAa,EAAE;QAEf,gBAAgB;YACd,CAAC,MAAM,YAAY,EAAE,CAAC,CAAC;gBACrB,GAAG,EAAE,YAAY,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE;aACjD,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}): Promise<Plugin[]> {\n const { isProduction, packagePath, enableTypescript, dynamicImports = [], sourcemap } = options;\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 enableTypescript &&\n (await getSwcPlugin())({\n swc: getSwcConfig({ packagePath, sourcemap }).ts,\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"]}
|
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,EAAiB,OAAO,
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,OAAO,EAA8B,MAAM,4BAA4B,CAAC;AAWrG,eAAO,MAAM,MAAM,EAAE,OAyDpB,CAAC"}
|
package/lib/rollup.js
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
|
+
import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';
|
|
1
2
|
import { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';
|
|
2
3
|
import { rollup as runRollup } from 'rollup';
|
|
3
4
|
import { getRollupOptions } from './getRollupOptions.js';
|
|
4
5
|
import { normalizeRollupLoc } from './normalizeRollupLoc.js';
|
|
5
6
|
import { normalizeRollupOutput } from './normalizeRollupOutput.js';
|
|
7
|
+
import { rollupCapabilities } from './rollupCapabilities.js';
|
|
8
|
+
const bundlerName = 'rollup';
|
|
6
9
|
export const rollup = {
|
|
7
|
-
name:
|
|
8
|
-
bundle: async function (options) {
|
|
10
|
+
name: bundlerName,
|
|
11
|
+
bundle: async function (options, context) {
|
|
9
12
|
const { newEntries, errors } = await writeESMStubsInWorker(options);
|
|
10
13
|
if (errors?.length) {
|
|
11
14
|
return { errors };
|
|
12
15
|
}
|
|
13
|
-
const {
|
|
16
|
+
const { warnings, ...baseConfig } = await getRollupOptions({ options, newEntries });
|
|
17
|
+
const bundlerCapabilitiesOptions = {
|
|
18
|
+
// Enable asset-inline by default for common image types
|
|
19
|
+
// The extension are not read from the options because they are not configurable,
|
|
20
|
+
// but these are the supported extensions by the plugin
|
|
21
|
+
'asset-inline': { extensions: ['jpg', 'png', 'gif', 'svg', 'webp'] },
|
|
22
|
+
...(options.bundlerCapabilities || {}),
|
|
23
|
+
};
|
|
24
|
+
const { inputOptions, outputOptions } = await processCapabilities({
|
|
25
|
+
bundlerName,
|
|
26
|
+
baseConfig,
|
|
27
|
+
bundlerCapabilitiesOptions,
|
|
28
|
+
internalCapabilities: rollupCapabilities,
|
|
29
|
+
bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,
|
|
30
|
+
});
|
|
14
31
|
let output;
|
|
15
32
|
try {
|
|
16
33
|
const result = await runRollup(inputOptions);
|
package/lib/rollup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,MAAM,IAAI,SAAS,EAAuC,MAAM,QAAQ,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EA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apabilitiesOptions } from '@ms-cloudpack/common-types';\nimport { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';\nimport { rollup as runRollup, type RollupError, type RollupOutput } from 'rollup';\nimport { getRollupOptions } from './getRollupOptions.js';\nimport { normalizeRollupLoc } from './normalizeRollupLoc.js';\nimport { normalizeRollupOutput } from './normalizeRollupOutput.js';\nimport { rollupCapabilities } from './rollupCapabilities.js';\n\nconst bundlerName = 'rollup';\n\nexport const rollup: Bundler = {\n name: bundlerName,\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 } = await getRollupOptions({ options, newEntries });\n\n const bundlerCapabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset-inline by default for common image types\n // The extension are not read from the options because they are not configurable,\n // but these are the supported extensions by the plugin\n 'asset-inline': { extensions: ['jpg', 'png', 'gif', 'svg', 'webp'] },\n ...(options.bundlerCapabilities || {}),\n };\n\n const { inputOptions, outputOptions } = await processCapabilities({\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"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
|
@@ -0,0 +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,CAmBA,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { mergeObjects } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
import _image from '@rollup/plugin-image';
|
|
3
|
+
// See more about the type workaround at getRollupPlugins.ts
|
|
4
|
+
const image = _image;
|
|
5
|
+
export const rollupCapabilities = {
|
|
6
|
+
'asset-inline': (config) => {
|
|
7
|
+
// Add the image plugin to the rollup configuration
|
|
8
|
+
if (!config.inputOptions.plugins) {
|
|
9
|
+
config.inputOptions.plugins = [];
|
|
10
|
+
}
|
|
11
|
+
else if (!Array.isArray(config.inputOptions.plugins)) {
|
|
12
|
+
config.inputOptions.plugins = [config.inputOptions.plugins];
|
|
13
|
+
}
|
|
14
|
+
config.inputOptions.plugins.push(image());
|
|
15
|
+
return config;
|
|
16
|
+
},
|
|
17
|
+
alias: (config, options) => {
|
|
18
|
+
// Add aliases to the ori configuration
|
|
19
|
+
config.outputOptions.paths = mergeObjects([config.outputOptions.paths || {}, options]);
|
|
20
|
+
return config;
|
|
21
|
+
},
|
|
22
|
+
// This is a placeholder for the density capability. It doesn't do anything in the bundler.
|
|
23
|
+
// It's just a workaround for a post-bundle task. This will be replaced with 'plugins' in the future.
|
|
24
|
+
density: (config) => config,
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=rollupCapabilities.js.map
|
|
@@ -0,0 +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,MAAM,MAAM,sBAAsB,CAAC;AAE1C,4DAA4D;AAC5D,MAAM,KAAK,GAAG,MAA0C,CAAC;AAEzD,MAAM,CAAC,MAAM,kBAAkB,GAG1B;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE;QACzB,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,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1C,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 _image from '@rollup/plugin-image';\n\n// See more about the type workaround at getRollupPlugins.ts\nconst image = _image as unknown as typeof _image.default;\n\nexport const rollupCapabilities: InternalBundlerCapabilityImplementations<{\n inputOptions: RollupOptions;\n outputOptions: OutputOptions;\n}> = {\n 'asset-inline': (config) => {\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(image());\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-rollup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A cloudpack plugin for abstracting rollup.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -11,12 +11,18 @@
|
|
|
11
11
|
"source": "./src/index.ts",
|
|
12
12
|
"types": "./lib/index.d.ts",
|
|
13
13
|
"import": "./lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./plugins/commonjs": {
|
|
16
|
+
"source": "./src/plugins/commonjs/index.js",
|
|
17
|
+
"types": "./lib/plugins/commonjs/index.d.ts",
|
|
18
|
+
"import": "./lib/plugins/commonjs/index.js"
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
21
|
"dependencies": {
|
|
22
|
+
"@ms-cloudpack/bundler-capabilities": "^0.2.2",
|
|
17
23
|
"@ms-cloudpack/bundler-utilities": "^0.1.14",
|
|
18
24
|
"@ms-cloudpack/common-types": "^0.23.5",
|
|
19
|
-
"@ms-cloudpack/esm-stub-utilities": "^0.13.
|
|
25
|
+
"@ms-cloudpack/esm-stub-utilities": "^0.13.19",
|
|
20
26
|
"@ms-cloudpack/package-utilities": "^10.4.1",
|
|
21
27
|
"@ms-cloudpack/path-string-parsing": "^1.2.5",
|
|
22
28
|
"@ms-cloudpack/path-utilities": "^2.7.55",
|