@ms-cloudpack/bundler-utilities 0.7.4 → 0.8.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/constants.d.ts +0 -1
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +0 -20
- package/lib/constants.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/processAssetInlineExtensions.d.ts +2 -2
- package/lib/processAssetInlineExtensions.d.ts.map +1 -1
- package/lib/processAssetInlineExtensions.js +4 -6
- package/lib/processAssetInlineExtensions.js.map +1 -1
- package/lib/requiresTranspile.d.ts.map +1 -1
- package/lib/requiresTranspile.js +2 -3
- package/lib/requiresTranspile.js.map +1 -1
- package/package.json +4 -4
package/lib/constants.d.ts
CHANGED
package/lib/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
|
package/lib/constants.js
CHANGED
|
@@ -6,24 +6,4 @@
|
|
|
6
6
|
* ES2023 features are obviously relevant for a bundler), so stick with ES2022 for now.
|
|
7
7
|
*/
|
|
8
8
|
export const defaultTargetSyntax = 'es2022';
|
|
9
|
-
export const base64AssetExtensions = [
|
|
10
|
-
'.aac',
|
|
11
|
-
'.bmp',
|
|
12
|
-
'.gif',
|
|
13
|
-
'.jpeg',
|
|
14
|
-
'.jpg',
|
|
15
|
-
'.mp3',
|
|
16
|
-
'.mp4',
|
|
17
|
-
'.ogg',
|
|
18
|
-
'.otf',
|
|
19
|
-
'.png',
|
|
20
|
-
'.svg',
|
|
21
|
-
'.ttf',
|
|
22
|
-
'.wav',
|
|
23
|
-
'.webp',
|
|
24
|
-
'.woff',
|
|
25
|
-
'.woff2',
|
|
26
|
-
'.eot',
|
|
27
|
-
'.avif',
|
|
28
|
-
];
|
|
29
9
|
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC","sourcesContent":["/**\n * Default ES syntax level. 2022 is the minimum for top-level await.\n *\n * ES2023 is probably fine for browsers (definitely for development), and Node 20 also supports it.\n * But for some reason, rspack only lists up to ES2022 in its valid targets (and none of the\n * ES2023 features are obviously relevant for a bundler), so stick with ES2022 for now.\n */\nexport const defaultTargetSyntax = 'es2022';\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defaultTargetSyntax
|
|
1
|
+
export { defaultTargetSyntax } from './constants.js';
|
|
2
2
|
export { getModuleSearchPaths } from './getModuleSearchPaths.js';
|
|
3
3
|
export { getSwcConfig } from './getSwcConfig.js';
|
|
4
4
|
export { shouldExternalizePackage } from './shouldExternalizePackage.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defaultTargetSyntax
|
|
1
|
+
export { defaultTargetSyntax } from './constants.js';
|
|
2
2
|
export { getModuleSearchPaths } from './getModuleSearchPaths.js';
|
|
3
3
|
export { getSwcConfig } from './getSwcConfig.js';
|
|
4
4
|
export { shouldExternalizePackage } from './shouldExternalizePackage.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { defaultTargetSyntax } from './constants.js';\nexport { getModuleSearchPaths } from './getModuleSearchPaths.js';\nexport { getSwcConfig } from './getSwcConfig.js';\nexport { shouldExternalizePackage } from './shouldExternalizePackage.js';\nexport { getCssRule } from './getCssRule.js';\nexport { processAssetInlineExtensions } from './processAssetInlineExtensions.js';\nexport { requiresTranspile } from './requiresTranspile.js';\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param extensions - Can be either:
|
|
5
5
|
* - Array: Replace default list with these extensions (without leading dots per documentation)
|
|
6
6
|
* - Object: Modify default list (false removes, true adds extensions, without leading dots per documentation)
|
|
7
|
-
* @returns Processed array of extensions (with leading dots, matching
|
|
7
|
+
* @returns Processed array of extensions (with leading dots, matching `path.extname()` format)
|
|
8
8
|
*/
|
|
9
|
-
export declare function processAssetInlineExtensions(extensions: string[] | Record<string, boolean>): string[];
|
|
9
|
+
export declare function processAssetInlineExtensions(extensions: readonly string[] | Record<string, boolean>): string[];
|
|
10
10
|
//# sourceMappingURL=processAssetInlineExtensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processAssetInlineExtensions.d.ts","sourceRoot":"","sources":["../src/processAssetInlineExtensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processAssetInlineExtensions.d.ts","sourceRoot":"","sources":["../src/processAssetInlineExtensions.ts"],"names":[],"mappings":"AASA;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAoB9G"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { base64AssetExtensions } from '
|
|
1
|
+
import { base64AssetExtensions } from '@ms-cloudpack/path-utilities';
|
|
2
2
|
/**
|
|
3
|
-
* Normalize extension by ensuring it has a leading dot (matching
|
|
4
|
-
* Strips the dot if present in input and adds it back for consistency.
|
|
3
|
+
* Normalize extension by ensuring it has a leading dot (matching `path.extname()` format).
|
|
5
4
|
*/
|
|
6
5
|
function normalizeExtension(ext) {
|
|
7
|
-
|
|
8
|
-
return `.${stripped}`;
|
|
6
|
+
return ext[0] === '.' ? ext : `.${ext}`;
|
|
9
7
|
}
|
|
10
8
|
/**
|
|
11
9
|
* Process asset inline extensions based on the input format.
|
|
@@ -13,7 +11,7 @@ function normalizeExtension(ext) {
|
|
|
13
11
|
* @param extensions - Can be either:
|
|
14
12
|
* - Array: Replace default list with these extensions (without leading dots per documentation)
|
|
15
13
|
* - Object: Modify default list (false removes, true adds extensions, without leading dots per documentation)
|
|
16
|
-
* @returns Processed array of extensions (with leading dots, matching
|
|
14
|
+
* @returns Processed array of extensions (with leading dots, matching `path.extname()` format)
|
|
17
15
|
*/
|
|
18
16
|
export function processAssetInlineExtensions(extensions) {
|
|
19
17
|
// Array format: replace the entire default list
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processAssetInlineExtensions.js","sourceRoot":"","sources":["../src/processAssetInlineExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"processAssetInlineExtensions.js","sourceRoot":"","sources":["../src/processAssetInlineExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;GAEG;AACH,SAAS,kBAAkB,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;AAC1C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,UAAuD;IAClG,gDAAgD;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO,UAAU,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC5C,CAAC;IAED,yCAAyC;IACzC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAE9C,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACxD,MAAM,aAAa,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAE9C,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import { base64AssetExtensions } from '@ms-cloudpack/path-utilities';\n\n/**\n * Normalize extension by ensuring it has a leading dot (matching `path.extname()` format).\n */\nfunction normalizeExtension(ext: string): string {\n return ext[0] === '.' ? ext : `.${ext}`;\n}\n\n/**\n * Process asset inline extensions based on the input format.\n *\n * @param extensions - Can be either:\n * - Array: Replace default list with these extensions (without leading dots per documentation)\n * - Object: Modify default list (false removes, true adds extensions, without leading dots per documentation)\n * @returns Processed array of extensions (with leading dots, matching `path.extname()` format)\n */\nexport function processAssetInlineExtensions(extensions: readonly string[] | Record<string, boolean>): string[] {\n // Array format: replace the entire default list\n if (Array.isArray(extensions)) {\n return extensions.map(normalizeExtension);\n }\n\n // Object format: modify the default list\n const result = new Set(base64AssetExtensions);\n\n for (const [ext, include] of Object.entries(extensions)) {\n const normalizedExt = normalizeExtension(ext);\n\n if (include) {\n result.add(normalizedExt);\n } else {\n result.delete(normalizedExt);\n }\n }\n\n return Array.from(result);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requiresTranspile.d.ts","sourceRoot":"","sources":["../src/requiresTranspile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"requiresTranspile.d.ts","sourceRoot":"","sources":["../src/requiresTranspile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG/E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,SAAS,GAAG,qBAAqB,CAAC,GAClF,aAAa,CAAC,mBAAmB,CAAC,CAMpC"}
|
package/lib/requiresTranspile.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { isExternalPackage,
|
|
2
|
-
import path from 'path';
|
|
1
|
+
import { isExternalPackage, sourceRegex } from '@ms-cloudpack/path-utilities';
|
|
3
2
|
/**
|
|
4
3
|
* Returns whether the package needs to be transpiled before bundling (see `BundleContext.requiresTranspile`).
|
|
5
4
|
*
|
|
@@ -8,6 +7,6 @@ import path from 'path';
|
|
|
8
7
|
export function requiresTranspile(bundleOptions) {
|
|
9
8
|
return (!isExternalPackage(bundleOptions.inputPath) ||
|
|
10
9
|
!!bundleOptions.bundlerCapabilities?.relay ||
|
|
11
|
-
Object.values(bundleOptions.entries).some((fileName) =>
|
|
10
|
+
Object.values(bundleOptions.entries).some((fileName) => sourceRegex.test(fileName)));
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=requiresTranspile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requiresTranspile.js","sourceRoot":"","sources":["../src/requiresTranspile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"requiresTranspile.js","sourceRoot":"","sources":["../src/requiresTranspile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE9E;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,aAAmF;IAEnF,OAAO,CACL,CAAC,iBAAiB,CAAC,aAAa,CAAC,SAAS,CAAC;QAC3C,CAAC,CAAC,aAAa,CAAC,mBAAmB,EAAE,KAAK;QAC1C,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CACpF,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleContext, BundleOptions } from '@ms-cloudpack/common-types';\nimport { isExternalPackage, sourceRegex } from '@ms-cloudpack/path-utilities';\n\n/**\n * Returns whether the package needs to be transpiled before bundling (see `BundleContext.requiresTranspile`).\n *\n * (This is in a shared location so it can be used by tests too.)\n */\nexport function requiresTranspile(\n bundleOptions: Pick<BundleOptions, 'inputPath' | 'entries' | 'bundlerCapabilities'>,\n): BundleContext['requiresTranspile'] {\n return (\n !isExternalPackage(bundleOptions.inputPath) ||\n !!bundleOptions.bundlerCapabilities?.relay ||\n Object.values(bundleOptions.entries).some((fileName) => sourceRegex.test(fileName))\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-utilities",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Utilities used by multiple Cloudpack bundlers implementations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@ms-cloudpack/json-utilities": "^0.1.11",
|
|
28
|
-
"@ms-cloudpack/package-utilities": "^13.2.
|
|
28
|
+
"@ms-cloudpack/package-utilities": "^13.2.5",
|
|
29
29
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
30
|
-
"@ms-cloudpack/path-utilities": "^3.2.
|
|
30
|
+
"@ms-cloudpack/path-utilities": "^3.2.2",
|
|
31
31
|
"get-tsconfig": "^4.7.2",
|
|
32
32
|
"tsconfig-to-swcconfig": "^2.7.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@ms-cloudpack/common-types": "^0.33.
|
|
35
|
+
"@ms-cloudpack/common-types": "^0.33.1",
|
|
36
36
|
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
37
37
|
"@ms-cloudpack/scripts": "^0.0.1",
|
|
38
38
|
"@ms-cloudpack/test-utilities": "^0.5.0",
|