@ms-cloudpack/package-utilities 5.10.3 → 5.10.5

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,8 +1,8 @@
1
1
  /**
2
2
  * Determines if a package should be externalized from the bundle.
3
- * Don't externalize inlined packages, or node builtins, or absolute paths, or relative paths.
3
+ * Don't externalize inlined packages, node builtins, absolute paths, or relative paths.
4
4
  */
5
- export declare function shouldExternalizePackage({ id, inlined, external, polyfills, shouldInlineNodeBuiltins, }: {
5
+ export declare function shouldExternalizePackage(params: {
6
6
  id: string;
7
7
  inlined?: string[];
8
8
  external?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"shouldExternalizePackage.d.ts","sourceRoot":"","sources":["../src/shouldExternalizePackage.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,EAAE,EACF,OAAO,EACP,QAAQ,EACR,SAAS,EACT,wBAAwB,GACzB,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,wBAAwB,EAAE,OAAO,CAAC;CACnC,GAAG,OAAO,CAOV"}
1
+ {"version":3,"file":"shouldExternalizePackage.d.ts","sourceRoot":"","sources":["../src/shouldExternalizePackage.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,wBAAwB,EAAE,OAAO,CAAC;CACnC,GAAG,OAAO,CAUV"}
@@ -1,14 +1,17 @@
1
1
  import path from 'path';
2
2
  import { isBuiltin } from 'module';
3
+ import { parseImportString } from '@ms-cloudpack/path-string-parsing';
3
4
  /**
4
5
  * Determines if a package should be externalized from the bundle.
5
- * Don't externalize inlined packages, or node builtins, or absolute paths, or relative paths.
6
+ * Don't externalize inlined packages, node builtins, absolute paths, or relative paths.
6
7
  */
7
- export function shouldExternalizePackage({ id, inlined, external, polyfills, shouldInlineNodeBuiltins, }) {
8
- return !(inlined?.includes(id) ||
9
- (shouldInlineNodeBuiltins && isInlinedNodeBuiltin(id, external, polyfills)) ||
8
+ export function shouldExternalizePackage(params) {
9
+ const { id, inlined, external, polyfills, shouldInlineNodeBuiltins } = params;
10
+ return !((shouldInlineNodeBuiltins && isInlinedNodeBuiltin(id, external, polyfills)) ||
10
11
  path.isAbsolute(id) ||
11
- isRelative(id));
12
+ isRelative(id) ||
13
+ // The length check ensures that parseImportString is only called when there are inlined deps
14
+ (inlined?.length && inlined.includes(parseImportString(id).packageName)));
12
15
  }
13
16
  // We should inline node builtins that are handled by the nodePolyfills plugin.
14
17
  // Except if the dependency is listed as external.
@@ -1 +1 @@
1
- {"version":3,"file":"shouldExternalizePackage.js","sourceRoot":"","sources":["../src/shouldExternalizePackage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,EAAE,EACF,OAAO,EACP,QAAQ,EACR,SAAS,EACT,wBAAwB,GAOzB;IACC,OAAO,CAAC,CACN,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QACrB,CAAC,wBAAwB,IAAI,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC3E,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,CAAC,CACf,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,kDAAkD;AAClD,SAAS,oBAAoB,CAAC,EAAU,EAAE,QAAmB,EAAE,SAAuB;IACpF,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,UAAU,CAAC,EAAU;IAC5B,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AACxG,CAAC","sourcesContent":["import path from 'path';\nimport { isBuiltin } from 'module';\n\n/**\n * Determines if a package should be externalized from the bundle.\n * Don't externalize inlined packages, or node builtins, or absolute paths, or relative paths.\n */\nexport function shouldExternalizePackage({\n id,\n inlined,\n external,\n polyfills,\n shouldInlineNodeBuiltins,\n}: {\n id: string;\n inlined?: string[];\n external?: string[];\n polyfills?: Set<string>;\n shouldInlineNodeBuiltins: boolean;\n}): boolean {\n return !(\n inlined?.includes(id) ||\n (shouldInlineNodeBuiltins && isInlinedNodeBuiltin(id, external, polyfills)) ||\n path.isAbsolute(id) ||\n isRelative(id)\n );\n}\n\n// We should inline node builtins that are handled by the nodePolyfills plugin.\n// Except if the dependency is listed as external.\nfunction isInlinedNodeBuiltin(id: string, external?: string[], polyfills?: Set<string>) {\n return (isBuiltin(id) || polyfills?.has(id)) && !external?.find((ex) => id.startsWith(ex));\n}\n\nfunction isRelative(id: string) {\n return id.startsWith('/') || id.startsWith('./') || id.startsWith('../') || id === '.' || id === '..';\n}\n"]}
1
+ {"version":3,"file":"shouldExternalizePackage.js","sourceRoot":"","sources":["../src/shouldExternalizePackage.ts"],"names":[],"mappings":"AAAA,OA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Determines if a package should be externalized from the bundle.\n * Don't externalize inlined packages, node builtins, absolute paths, or relative paths.\n */\nexport function shouldExternalizePackage(params: {\n id: string;\n inlined?: string[];\n external?: string[];\n polyfills?: Set<string>;\n shouldInlineNodeBuiltins: boolean;\n}): boolean {\n const { id, inlined, external, polyfills, shouldInlineNodeBuiltins } = params;\n\n return !(\n (shouldInlineNodeBuiltins && isInlinedNodeBuiltin(id, external, polyfills)) ||\n path.isAbsolute(id) ||\n isRelative(id) ||\n // The length check ensures that parseImportString is only called when there are inlined deps\n (inlined?.length && inlined.includes(parseImportString(id).packageName))\n );\n}\n\n// We should inline node builtins that are handled by the nodePolyfills plugin.\n// Except if the dependency is listed as external.\nfunction isInlinedNodeBuiltin(id: string, external: string[] | undefined, polyfills: Set<string> | undefined) {\n return (isBuiltin(id) || polyfills?.has(id)) && !external?.find((ex) => id.startsWith(ex));\n}\n\nfunction isRelative(id: string) {\n return id.startsWith('/') || id.startsWith('./') || id.startsWith('../') || id === '.' || id === '..';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/package-utilities",
3
- "version": "5.10.3",
3
+ "version": "5.10.5",
4
4
  "description": "Utilities for resolving/parsing packages and their imports.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,10 +14,10 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/bundler-types": "^0.24.3",
18
- "@ms-cloudpack/config-types": "^0.5.0",
17
+ "@ms-cloudpack/bundler-types": "^0.24.5",
18
+ "@ms-cloudpack/config-types": "^0.5.1",
19
19
  "@ms-cloudpack/json-utilities": "^0.1.4",
20
- "@ms-cloudpack/package-overrides": "^0.6.19",
20
+ "@ms-cloudpack/package-overrides": "^0.6.21",
21
21
  "@ms-cloudpack/path-utilities": "^2.5.0",
22
22
  "@ms-cloudpack/path-string-parsing": "^1.1.3",
23
23
  "acorn": "^8.11.2",