@ms-cloudpack/bundler-webpack 0.1.5 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6C,OAAO,EAAE,MAAM,4BAA4B,CAAC;AASrG,eAAO,MAAM,OAAO,EAAE,OAiDrB,CAAC"}
1
+ {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6C,OAAO,EAAE,MAAM,4BAA4B,CAAC;AASrG,eAAO,MAAM,OAAO,EAAE,OAkDrB,CAAC"}
package/lib/webpack.js CHANGED
@@ -29,6 +29,7 @@ export const webpack = {
29
29
  baseConfig: getWebpackConfiguration({ options, outputPath, newEntries }, context),
30
30
  bundlerCapabilitiesOptions,
31
31
  internalCapabilities: webpackCapabilities,
32
+ bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,
32
33
  });
33
34
  try {
34
35
  const stats = await new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.js","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,UAA0B,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,MAAM,CAAC,MAAM,OAAO,GAAY;IAC9B,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,KAAK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,CAAC,CAAC,CAAC;YAEH,2FAA2F;YAC3F,OAAO,sBAAsB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QACxE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,YAAY,GAAkB,EAAE,IAAI,EAAG,GAAa,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;YACzG,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBACtC,oCAAoC;gBACpC,YAAY,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;YACjH,CAAC;YACD,OAAO;gBACL,MAAM,EAAE,CAAC,YAAY,CAAC;gBACtB,QAAQ,EAAE,MAAiC;aAC5C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport type { BundleMessage, BundlerCapabilitiesOptions, Bundler } from '@ms-cloudpack/common-types';\nimport { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';\nimport runWebpack, { type Stats } from 'webpack';\nimport { getWebpackConfiguration } from './getWebpackConfiguration.js';\nimport { normalizeWebpackOutput } from './normalizeWebpackOutput.js';\nimport { webpackCapabilities } from './webpackCapabilities.js';\n\nconst bundlerName = 'webpack';\n\nexport const webpack: Bundler = {\n name: bundlerName,\n bundle: async function (options, context) {\n const { errors, newEntries } = await writeESMStubsInWorker(options);\n if (errors?.length) {\n return { errors };\n }\n\n const outputPath = options.outputPath ?? options.inputPath;\n\n const defaultExtensionsToInline = ['png', 'jpg', 'jpeg', 'gif'];\n const { unsafeDisableInlineSvg = false } = options.bundlerOptions || {};\n // TODO: This will be deleted in the upcoming PRs\n if (!unsafeDisableInlineSvg) {\n defaultExtensionsToInline.push('svg');\n }\n\n const bundlerCapabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset-inline by default for common image types\n 'asset-inline': { extensions: defaultExtensionsToInline },\n ...(options.bundlerCapabilities || {}),\n };\n\n const config = await processCapabilities({\n bundlerName,\n baseConfig: getWebpackConfiguration({ options, outputPath, newEntries }, context),\n bundlerCapabilitiesOptions,\n internalCapabilities: webpackCapabilities,\n });\n\n try {\n const stats = await new Promise<Stats | undefined>((resolve, reject) => {\n runWebpack(config, (err, statsResult) => (err ? reject(err) : resolve(statsResult)));\n });\n\n // Normalize the output outside the callback, so if there's an exception it's not swallowed\n return normalizeWebpackOutput({ stats, config, outputPath, options });\n } catch (err) {\n const errorMessage: BundleMessage = { text: (err as Error).message || String(err), source: bundlerName };\n if (err instanceof Error && err.stack) {\n // remove the message from the stack\n errorMessage.notes = [{ text: err.stack.includes(err.message) ? err.stack.split(err.message)[1] : err.stack }];\n }\n return {\n errors: [errorMessage],\n rawInput: config as Record<string, unknown>,\n };\n }\n },\n};\n"]}
1
+ {"version":3,"file":"webpack.js","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,UAA0B,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,MAAM,CAAC,MAAM,OAAO,GAAY;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AAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YACvF,CAAC,CAAC,CAAC;YAEH,2FAA2F;YAC3F,OAAO,sBAAsB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QACxE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,YAAY,GAAkB,EAAE,IAAI,EAAG,GAAa,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;YACzG,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBACtC,oCAAoC;gBACpC,YAAY,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;YACjH,CAAC;YACD,OAAO;gBACL,MAAM,EAAE,CAAC,YAAY,CAAC;gBACtB,QAAQ,EAAE,MAAiC;aAC5C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport type { BundleMessage, BundlerCapabilitiesOptions, Bundler } from '@ms-cloudpack/common-types';\nimport { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';\nimport runWebpack, { type Stats } from 'webpack';\nimport { getWebpackConfiguration } from './getWebpackConfiguration.js';\nimport { normalizeWebpackOutput } from './normalizeWebpackOutput.js';\nimport { webpackCapabilities } from './webpackCapabilities.js';\n\nconst bundlerName = 'webpack';\n\nexport const webpack: Bundler = {\n name: bundlerName,\n bundle: async function (options, context) {\n const { errors, newEntries } = await writeESMStubsInWorker(options);\n if (errors?.length) {\n return { errors };\n }\n\n const outputPath = options.outputPath ?? options.inputPath;\n\n const defaultExtensionsToInline = ['png', 'jpg', 'jpeg', 'gif'];\n const { unsafeDisableInlineSvg = false } = options.bundlerOptions || {};\n // TODO: This will be deleted in the upcoming PRs\n if (!unsafeDisableInlineSvg) {\n defaultExtensionsToInline.push('svg');\n }\n\n const bundlerCapabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset-inline by default for common image types\n 'asset-inline': { extensions: defaultExtensionsToInline },\n ...(options.bundlerCapabilities || {}),\n };\n\n const config = await processCapabilities({\n bundlerName,\n baseConfig: getWebpackConfiguration({ options, outputPath, newEntries }, context),\n bundlerCapabilitiesOptions,\n internalCapabilities: webpackCapabilities,\n bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,\n });\n\n try {\n const stats = await new Promise<Stats | undefined>((resolve, reject) => {\n runWebpack(config, (err, statsResult) => (err ? reject(err) : resolve(statsResult)));\n });\n\n // Normalize the output outside the callback, so if there's an exception it's not swallowed\n return normalizeWebpackOutput({ stats, config, outputPath, options });\n } catch (err) {\n const errorMessage: BundleMessage = { text: (err as Error).message || String(err), source: bundlerName };\n if (err instanceof Error && err.stack) {\n // remove the message from the stack\n errorMessage.notes = [{ text: err.stack.includes(err.message) ? err.stack.split(err.message)[1] : err.stack }];\n }\n return {\n errors: [errorMessage],\n rawInput: config as Record<string, unknown>,\n };\n }\n },\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/bundler-webpack",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "A cloudpack plugin for abstracting webpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,12 +14,12 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/bundler-capabilities": "^0.1.27",
18
- "@ms-cloudpack/bundler-utilities": "^0.1.6",
19
- "@ms-cloudpack/common-types": "^0.23.1",
20
- "@ms-cloudpack/esm-stub-utilities": "^0.13.10",
17
+ "@ms-cloudpack/bundler-capabilities": "^0.2.0",
18
+ "@ms-cloudpack/bundler-utilities": "^0.1.8",
19
+ "@ms-cloudpack/common-types": "^0.23.3",
20
+ "@ms-cloudpack/esm-stub-utilities": "^0.13.12",
21
21
  "@ms-cloudpack/path-string-parsing": "^1.2.4",
22
- "@ms-cloudpack/path-utilities": "^2.7.50",
22
+ "@ms-cloudpack/path-utilities": "^2.7.52",
23
23
  "@swc/core": "^1.3.0",
24
24
  "css-loader": "^6.0.0",
25
25
  "ejs-loader": "^0.5.0",