@ms-cloudpack/bundler 0.23.24 → 0.23.25

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,6 +1,6 @@
1
- import { flattenExportsMap, getExportsMap, isExternalPackage } from '@ms-cloudpack/package-utilities';
1
+ import { flattenExportsMap, getExportsMap } from '@ms-cloudpack/package-utilities';
2
2
  import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';
3
- import { intermediateToSourcePath } from '@ms-cloudpack/path-utilities';
3
+ import { intermediateToSourcePath, isExternalPackage } from '@ms-cloudpack/path-utilities';
4
4
  import path from 'path';
5
5
  import { isValidBundleEntry } from './isValidBundleEntry.js';
6
6
  import { toNormalizedEntryKey } from './toNormalizedEntryKey.js';
@@ -1 +1 @@
1
- {"version":3,"file":"getEntriesMapFromPackage.js","sourceRoot":"","sources":["../src/getEntriesMapFromPackage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,OAEC,EACD,OAGC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC9B,MAAM,UAAU,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5E,MAAM,YAAY,GAAG,iBAAiB,CA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esContent":["import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport { flattenExportsMap, getExportsMap, isExternalPackage } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { intermediateToSourcePath } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { isValidBundleEntry } from './isValidBundleEntry.js';\nimport { toNormalizedEntryKey } from './toNormalizedEntryKey.js';\n\n/**\n * Gets the entries map for a given package. An entries map is different from an exports map in that\n * the keys are relative paths to where the output should live, rather than how the entry is imported.\n * The data structure is used for bundler config; not for resolution of imports.\n */\nexport async function getEntriesMapFromPackage(\n options: {\n inputPath: string;\n },\n context: {\n packages: PackageDefinitionsCache;\n config: Pick<CloudpackConfig, 'features'>;\n },\n): Promise<Record<string, string>> {\n const { inputPath } = options;\n const isInternal = !isExternalPackage(inputPath);\n const exportsMap = await getExportsMap({ packagePath: inputPath }, context);\n const flattenedMap = flattenExportsMap(exportsMap);\n let sourceExportsMap: Record<string, string>;\n\n // The flattened map values tell us what physical files will show up in the import map on the page. We use these\n // as the keys for the entries map, which results in physical file output from the bundler.\n\n // For internal packages, we want the values (the inputs to the each entry) to use source paths if available. To\n // get these, we can either derive from exports map \"source\" entries, or if those are not available, we can attempt\n // to derive source paths from intermediate paths.\n\n if (isInternal) {\n sourceExportsMap = flattenExportsMap(exportsMap, {\n conditions: ['source'],\n requiredConditions: ['source'],\n });\n\n for (const [key, value] of Object.entries(flattenedMap)) {\n if (!sourceExportsMap[key]) {\n sourceExportsMap[key] = intermediateToSourcePath(value, inputPath) || value;\n }\n }\n }\n\n return Object.fromEntries(\n Object.entries(flattenedMap)\n .filter(([, value]) => isValidBundleEntry(value))\n .map(([key, value]) => [\n toNormalizedEntryKey(value),\n toNormalizedRelativePath(inputPath, sourceExportsMap?.[key] || value),\n ]),\n );\n}\n\nfunction toNormalizedRelativePath(inputPath: string, entry: string): string {\n if (path.isAbsolute(entry)) {\n entry = path.relative(inputPath, entry);\n }\n\n return normalizeRelativePath(entry);\n}\n"]}
1
+ {"version":3,"file":"getEntriesMapFromPackage.js","sourceRoot":"","sources":["../src/getEntriesMapFromPackage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,OAEC,EACD,OAGC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC9B,MAAM,UAAU,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5E,MAAM,YAAY,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACnD,IAAI,gBAAwC,CAAC;IAE7C,gHAAgH;IAChH,2FAA2F;IAE3F,gHAAgH;IAChH,mHAAmH;IACnH,kDAAkD;IAElD,IAAI,UAAU,EAAE,CAAC;QACf,gBAAgB,GAAG,iBAAiB,CAAC,UAAU,EAAE;YAC/C,UAAU,EAAE,CAAC,QAAQ,CAAC;YACtB,kBAAkB,EAAE,CAAC,QAAQ,CAAC;SAC/B,CAAC,CAAC;QAEH,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACxD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3B,gBAAgB,CAAC,GAAG,CAAC,GAAG,wBAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,KAAK,CAAC;YAC9E,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;SACzB,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QACrB,oBAAoB,CAAC,KAAK,CAAC;QAC3B,wBAAwB,CAAC,SAAS,EAAE,gBAAgB,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;KACtE,CAAC,CACL,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,SAAiB,EAAE,KAAa;IAChE,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport { flattenExportsMap, getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { intermediateToSourcePath, isExternalPackage } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { isValidBundleEntry } from './isValidBundleEntry.js';\nimport { toNormalizedEntryKey } from './toNormalizedEntryKey.js';\n\n/**\n * Gets the entries map for a given package. An entries map is different from an exports map in that\n * the keys are relative paths to where the output should live, rather than how the entry is imported.\n * The data structure is used for bundler config; not for resolution of imports.\n */\nexport async function getEntriesMapFromPackage(\n options: {\n inputPath: string;\n },\n context: {\n packages: PackageDefinitionsCache;\n config: Pick<CloudpackConfig, 'features'>;\n },\n): Promise<Record<string, string>> {\n const { inputPath } = options;\n const isInternal = !isExternalPackage(inputPath);\n const exportsMap = await getExportsMap({ packagePath: inputPath }, context);\n const flattenedMap = flattenExportsMap(exportsMap);\n let sourceExportsMap: Record<string, string>;\n\n // The flattened map values tell us what physical files will show up in the import map on the page. We use these\n // as the keys for the entries map, which results in physical file output from the bundler.\n\n // For internal packages, we want the values (the inputs to the each entry) to use source paths if available. To\n // get these, we can either derive from exports map \"source\" entries, or if those are not available, we can attempt\n // to derive source paths from intermediate paths.\n\n if (isInternal) {\n sourceExportsMap = flattenExportsMap(exportsMap, {\n conditions: ['source'],\n requiredConditions: ['source'],\n });\n\n for (const [key, value] of Object.entries(flattenedMap)) {\n if (!sourceExportsMap[key]) {\n sourceExportsMap[key] = intermediateToSourcePath(value, inputPath) || value;\n }\n }\n }\n\n return Object.fromEntries(\n Object.entries(flattenedMap)\n .filter(([, value]) => isValidBundleEntry(value))\n .map(([key, value]) => [\n toNormalizedEntryKey(value),\n toNormalizedRelativePath(inputPath, sourceExportsMap?.[key] || value),\n ]),\n );\n}\n\nfunction toNormalizedRelativePath(inputPath: string, entry: string): string {\n if (path.isAbsolute(entry)) {\n entry = path.relative(inputPath, entry);\n }\n\n return normalizeRelativePath(entry);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/bundler",
3
- "version": "0.23.24",
3
+ "version": "0.23.25",
4
4
  "description": "An abstraction to bundle source code.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,16 +14,16 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/bundler-ori": "^0.2.8",
18
- "@ms-cloudpack/bundler-rollup": "^0.2.2",
19
- "@ms-cloudpack/bundler-rspack": "^0.2.11",
20
- "@ms-cloudpack/bundler-webpack": "^0.2.10",
21
- "@ms-cloudpack/common-types": "^0.23.6",
22
- "@ms-cloudpack/config": "^0.33.3",
23
- "@ms-cloudpack/json-utilities": "^0.1.8",
24
- "@ms-cloudpack/package-utilities": "^10.4.2",
25
- "@ms-cloudpack/path-string-parsing": "^1.2.5",
26
- "@ms-cloudpack/path-utilities": "^2.7.56"
17
+ "@ms-cloudpack/bundler-ori": "^0.2.9",
18
+ "@ms-cloudpack/bundler-rollup": "^0.2.3",
19
+ "@ms-cloudpack/bundler-rspack": "^0.2.12",
20
+ "@ms-cloudpack/bundler-webpack": "^0.2.11",
21
+ "@ms-cloudpack/common-types": "^0.23.7",
22
+ "@ms-cloudpack/config": "^0.33.4",
23
+ "@ms-cloudpack/json-utilities": "^0.1.9",
24
+ "@ms-cloudpack/package-utilities": "^11.0.0",
25
+ "@ms-cloudpack/path-string-parsing": "^1.2.6",
26
+ "@ms-cloudpack/path-utilities": "^2.8.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.11"
9
- }
10
- ]
11
- }