@ms-cloudpack/bundler 0.22.18 → 0.22.20
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/getEntriesMapFromPackage.d.ts +1 -1
- package/lib/getEntriesMapFromPackage.d.ts.map +1 -1
- package/lib/getEntriesMapFromPackage.js.map +1 -1
- package/lib/getExternalsFromPackage.d.ts +5 -2
- package/lib/getExternalsFromPackage.d.ts.map +1 -1
- package/lib/getExternalsFromPackage.js +15 -12
- package/lib/getExternalsFromPackage.js.map +1 -1
- package/package.json +8 -8
|
@@ -8,6 +8,6 @@ export declare function getEntriesMapFromPackage(options: {
|
|
|
8
8
|
inputPath: string;
|
|
9
9
|
}, context: {
|
|
10
10
|
packages: PackageDefinitionsCache;
|
|
11
|
-
config: CloudpackConfig
|
|
11
|
+
config: Pick<CloudpackConfig, 'features'>;
|
|
12
12
|
}): Promise<Record<string, string>>;
|
|
13
13
|
//# sourceMappingURL=getEntriesMapFromPackage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntriesMapFromPackage.d.ts","sourceRoot":"","sources":["../src/getEntriesMapFromPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAO3F;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE;IACP,SAAS,EAAE,MAAM,CAAC;CACnB,EACD,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;IAClC,MAAM,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"getEntriesMapFromPackage.d.ts","sourceRoot":"","sources":["../src/getEntriesMapFromPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAO3F;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE;IACP,SAAS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tC,CAAC","sourcesContent":["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, sourceExtensions } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { isValidBundleEntry } from './isValidBundleEntry.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: CloudpackConfig
|
|
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,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;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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AwB,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, isExternalPackage } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { intermediateToSourcePath, sourceExtensions } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { isValidBundleEntry } from './isValidBundleEntry.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\n/**\n * When we derive keys, we want to preserve unknown script extensions. For others, remove them as the bundler\n * will add back `'.js'` for us in the output.\n */\nfunction toNormalizedEntryKey(entry: string): string {\n const extension = path.extname(entry);\n if (sourceExtensions.includes(extension)) {\n return entry.slice(0, -extension.length);\n }\n\n return entry;\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,11 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';
|
|
2
2
|
/**
|
|
3
3
|
* Reads a package definition and derives a flat array of dependencies to externalize for bundling.
|
|
4
|
+
*
|
|
5
|
+
* To reduce the chances of accidentally bundling something that should be external, this includes
|
|
6
|
+
* the names of original dependencies of all types (prior to transforms), as well as any
|
|
7
|
+
* `includedDependencies` from config that were added by `createPackageSettingsTransform`.
|
|
4
8
|
*/
|
|
5
9
|
export declare function getExternalsFromPackage(options: {
|
|
6
10
|
inputPath: string;
|
|
7
11
|
}, context: {
|
|
8
12
|
packages: PackageDefinitionsCache;
|
|
9
|
-
config: CloudpackConfig;
|
|
10
13
|
}): Promise<string[]>;
|
|
11
14
|
//# sourceMappingURL=getExternalsFromPackage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExternalsFromPackage.d.ts","sourceRoot":"","sources":["../src/getExternalsFromPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"getExternalsFromPackage.d.ts","sourceRoot":"","sources":["../src/getExternalsFromPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE;IACP,SAAS,EAAE,MAAM,CAAC;CACnB,EACD,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GACA,OAAO,CAAC,MAAM,EAAE,CAAC,CAenB"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reads a package definition and derives a flat array of dependencies to externalize for bundling.
|
|
3
|
+
*
|
|
4
|
+
* To reduce the chances of accidentally bundling something that should be external, this includes
|
|
5
|
+
* the names of original dependencies of all types (prior to transforms), as well as any
|
|
6
|
+
* `includedDependencies` from config that were added by `createPackageSettingsTransform`.
|
|
3
7
|
*/
|
|
4
8
|
export async function getExternalsFromPackage(options, context) {
|
|
5
9
|
const { inputPath } = options;
|
|
6
10
|
const { packages } = context;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return [];
|
|
11
|
+
const transformedDefinition = await packages.get(inputPath);
|
|
12
|
+
const originalDefinition = await packages.get(inputPath, { disableTransforms: true });
|
|
13
|
+
return Object.keys({
|
|
14
|
+
// Use mostly original dependencies in case of removals by createPackageSettingsTransform.
|
|
15
|
+
...originalDefinition?.dependencies,
|
|
16
|
+
...originalDefinition?.devDependencies,
|
|
17
|
+
...originalDefinition?.peerDependencies,
|
|
18
|
+
...originalDefinition?.optionalDependencies,
|
|
19
|
+
// Also use the transformed deps in case any includedDependencies weren't listed in orignal deps.
|
|
20
|
+
...transformedDefinition?.dependencies,
|
|
21
|
+
});
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=getExternalsFromPackage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExternalsFromPackage.js","sourceRoot":"","sources":["../src/getExternalsFromPackage.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"getExternalsFromPackage.js","sourceRoot":"","sources":["../src/getExternalsFromPackage.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAEC,EACD,OAEC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,MAAM,qBAAqB,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,kBAAkB,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;IAEtF,OAAO,MAAM,CAAC,IAAI,CAAC;QACjB,0FAA0F;QAC1F,GAAG,kBAAkB,EAAE,YAAY;QACnC,GAAG,kBAAkB,EAAE,eAAe;QACtC,GAAG,kBAAkB,EAAE,gBAAgB;QACvC,GAAG,kBAAkB,EAAE,oBAAoB;QAC3C,iGAAiG;QACjG,GAAG,qBAAqB,EAAE,YAAY;KACvC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\n\n/**\n * Reads a package definition and derives a flat array of dependencies to externalize for bundling.\n *\n * To reduce the chances of accidentally bundling something that should be external, this includes\n * the names of original dependencies of all types (prior to transforms), as well as any\n * `includedDependencies` from config that were added by `createPackageSettingsTransform`.\n */\nexport async function getExternalsFromPackage(\n options: {\n inputPath: string;\n },\n context: {\n packages: PackageDefinitionsCache;\n },\n): Promise<string[]> {\n const { inputPath } = options;\n const { packages } = context;\n const transformedDefinition = await packages.get(inputPath);\n const originalDefinition = await packages.get(inputPath, { disableTransforms: true });\n\n return Object.keys({\n // Use mostly original dependencies in case of removals by createPackageSettingsTransform.\n ...originalDefinition?.dependencies,\n ...originalDefinition?.devDependencies,\n ...originalDefinition?.peerDependencies,\n ...originalDefinition?.optionalDependencies,\n // Also use the transformed deps in case any includedDependencies weren't listed in orignal deps.\n ...transformedDefinition?.dependencies,\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.20",
|
|
4
4
|
"description": "An abstraction to bundle source code.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ms-cloudpack/bundler-plugin-ori": "^0.19.
|
|
18
|
-
"@ms-cloudpack/bundler-plugin-rollup": "^0.15.
|
|
19
|
-
"@ms-cloudpack/bundler-plugin-webpack": "^0.8.
|
|
20
|
-
"@ms-cloudpack/common-types": "^0.
|
|
21
|
-
"@ms-cloudpack/config": "^0.26.
|
|
17
|
+
"@ms-cloudpack/bundler-plugin-ori": "^0.19.16",
|
|
18
|
+
"@ms-cloudpack/bundler-plugin-rollup": "^0.15.7",
|
|
19
|
+
"@ms-cloudpack/bundler-plugin-webpack": "^0.8.4",
|
|
20
|
+
"@ms-cloudpack/common-types": "^0.17.0",
|
|
21
|
+
"@ms-cloudpack/config": "^0.26.3",
|
|
22
22
|
"@ms-cloudpack/json-utilities": "^0.1.7",
|
|
23
|
-
"@ms-cloudpack/package-utilities": "^9.0.
|
|
23
|
+
"@ms-cloudpack/package-utilities": "^9.0.4",
|
|
24
24
|
"@ms-cloudpack/path-string-parsing": "^1.2.4",
|
|
25
|
-
"@ms-cloudpack/path-utilities": "^2.7.
|
|
25
|
+
"@ms-cloudpack/path-utilities": "^2.7.35"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|