@ms-cloudpack/package-utilities 6.0.1 → 7.0.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/findFileInPackage.js +0 -1
- package/lib/findFileInPackage.js.map +1 -1
- package/lib/findPackage.d.ts.map +1 -1
- package/lib/findPackage.js +4 -1
- package/lib/findPackage.js.map +1 -1
- package/lib/getCandidates.js +0 -1
- package/lib/getCandidates.js.map +1 -1
- package/lib/getDisplayVersion.d.ts +9 -0
- package/lib/getDisplayVersion.d.ts.map +1 -0
- package/lib/getDisplayVersion.js +13 -0
- package/lib/getDisplayVersion.js.map +1 -0
- package/lib/getVersion.d.ts +2 -4
- package/lib/getVersion.d.ts.map +1 -1
- package/lib/getVersion.js +4 -17
- package/lib/getVersion.js.map +1 -1
- package/lib/getVersionInternal.d.ts +6 -0
- package/lib/getVersionInternal.d.ts.map +1 -0
- package/lib/getVersionInternal.js +17 -0
- package/lib/getVersionInternal.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
package/lib/findFileInPackage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findFileInPackage.js","sourceRoot":"","sources":["../src/findFileInPackage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"findFileInPackage.js","sourceRoot":"","sources":["../src/findFileInPackage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC9G,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,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AAI,eAAe,EAAE,CAAC;YACpB,wDAAwD;YACxD,UAAU,GAAG,wBAAwB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAE7D,mDAAmD;YACnD,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;gBAC5B,UAAU,GAAG,SAAS,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,+BAA+B;IAC/B,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;QAC3B,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE/C,qEAAqE;QACrE,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC;YAClE,SAAS,GAAG,SAAS,CAAC;QACxB,CAAC;IACH,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,CAAC,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,CAAC,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,UAAU,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { type CloudpackConfig } from '@ms-cloudpack/config-types';\nimport { normalizeRelativePath, slash } from '@ms-cloudpack/path-string-parsing';\nimport { intermediateToSourcePath, isFileSync, sourceToIntermediatePath } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { flattenExportsMap } from './flattenExportsMap.js';\nimport { getCandidates } from './getCandidates.js';\nimport { getExportsMap } from './getExportsMap.js';\nimport { isExternalPackage } from './isExternalPackage.js';\n\nconst sourceExtensions = ['.ts', '.tsx', '.cts', '.mts', '.jsx'];\nconst javascriptExtensions = ['.js', '.mjs', '.cjs'];\n\nexport type FindFileInPackageOptions = {\n packagePath: string;\n filePath: string;\n};\n\nexport type FindFileInPackageResult = {\n filePath?: string;\n typesPath?: string;\n sourcePath?: string;\n};\n\n/**\n * Given a requested partial filePath, resolves the relative intermediate path if the file exists, with special\n * consideration for internal packages, which may not have intermediate files but only source files. Paths returned\n * are always relative and start with `./`.\n *\n * This helper is used in deriving if the given package.json entries are actual validate candidates when constructing an\n * exports map from existing metadata. For example, a package.json may list `main` as `lib/index.js`. If this file\n * exists, or in internal packages, if `src/index.tsx` exists, then this is a valid candidate. If the file does not\n * exist, then we should not include it in the exports map.\n */\nexport async function findFileInPackage(\n options: FindFileInPackageOptions,\n context: { packages: PackageDefinitionsCache; config: CloudpackConfig },\n): Promise<FindFileInPackageResult> {\n const originalPath = normalizeRelativePath(options.filePath);\n const packagePath = slash(options.packagePath);\n let filePath: string | undefined;\n let sourcePath: string | undefined;\n let typesPath: string | undefined;\n const isInternal = !isExternalPackage(packagePath);\n const candidates = getCandidates({ filePath: originalPath, packagePath }, context);\n\n // Try and resolve a physical file given the candidates.\n // eslint-disable-next-line @ms-cloudpack/internal/no-sync-filesystem\n filePath = candidates.find((candidate) => isFileSync(path.join(packagePath, candidate)));\n\n const isNestedPackageDefinition =\n filePath && path.basename(filePath) === 'package.json' && path.basename(originalPath) !== 'package.json';\n const result: FindFileInPackageResult = {};\n\n if (isNestedPackageDefinition) {\n const nestedDefinitionPath = path.dirname(path.join(packagePath, filePath as string));\n const exportsMap = await getExportsMap({ packagePath: nestedDefinitionPath }, context);\n const entryPath = flattenExportsMap(exportsMap)['.'];\n\n if (entryPath) {\n typesPath = flattenExportsMap(exportsMap, { conditions: ['types'] })['.'];\n\n return {\n ...(await findFileInPackage(\n {\n packagePath,\n filePath: normalizeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, entryPath))),\n },\n context,\n )),\n typesPath:\n typesPath && normalizeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, typesPath))),\n };\n }\n }\n\n // If the resolved file is a typescript file in an internal package, try to resolve the intermediate.\n if (filePath && sourceExtensions.includes(path.extname(filePath))) {\n sourcePath = filePath;\n filePath = isInternal ? sourceToIntermediatePath(filePath) : undefined;\n }\n\n // If we haven't resolved a sourcePath, try to resolve it from the intermediate.\n if (isInternal && filePath && !sourcePath) {\n const ext = path.extname(filePath);\n const isJavaScriptExt = javascriptExtensions.includes(ext);\n\n if (isJavaScriptExt) {\n // Not a TS file, but a JS file. Try to find the source.\n sourcePath = intermediateToSourcePath(filePath, packagePath);\n\n // If we couldn't find a TS file, clear sourcePath.\n if (sourcePath === filePath) {\n sourcePath = undefined;\n }\n }\n }\n\n // Try to resolve the typesPath\n if (sourcePath && filePath) {\n typesPath = filePath.replace(/\\.js$/, '.d.ts');\n\n // eslint-disable-next-line @ms-cloudpack/internal/no-sync-filesystem\n if (!isInternal && !isFileSync(path.join(packagePath, typesPath))) {\n typesPath = undefined;\n }\n }\n\n if (typesPath) {\n result.typesPath = normalizeRelativePath(typesPath);\n }\n\n if (filePath) {\n result.filePath = normalizeRelativePath(filePath);\n }\n\n if (sourcePath) {\n result.sourcePath = normalizeRelativePath(sourcePath);\n }\n\n return result;\n}\n"]}
|
package/lib/findPackage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findPackage.d.ts","sourceRoot":"","sources":["../src/findPackage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAEnG;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,EACD,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GACA,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"findPackage.d.ts","sourceRoot":"","sources":["../src/findPackage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAEnG;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,EACD,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GACA,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,GAAG,SAAS,CAAC,CAgCvE"}
|
package/lib/findPackage.js
CHANGED
|
@@ -8,6 +8,7 @@ export async function findPackage(options, context) {
|
|
|
8
8
|
const { dependencyName, rootPath, startPath, importerContext } = options;
|
|
9
9
|
const { packages } = context;
|
|
10
10
|
let packagePath = startPath;
|
|
11
|
+
const isStoreLayout = /[\\/]\.(pnpm|store)[\\/]/.test(packagePath);
|
|
11
12
|
do {
|
|
12
13
|
const resolvedPath = path.join(packagePath, 'node_modules', dependencyName);
|
|
13
14
|
const definition = await packages.get(resolvedPath, { importerContext });
|
|
@@ -17,7 +18,9 @@ export async function findPackage(options, context) {
|
|
|
17
18
|
// We haven't found it. Try to move up a directory.
|
|
18
19
|
packagePath = path.dirname(packagePath);
|
|
19
20
|
// If we moved up into a scope folder, skip over it.
|
|
20
|
-
|
|
21
|
+
// Exception: in a manager using a store layout, packages starting with @ are NOT scope folders;
|
|
22
|
+
// e.g. @foo/bar will be in a folder like @foo-bar-npm-1.2.3-abcdef1234 or @foo-bar@1.2.3
|
|
23
|
+
if (!isStoreLayout && path.basename(packagePath).startsWith('@')) {
|
|
21
24
|
packagePath = path.dirname(packagePath);
|
|
22
25
|
}
|
|
23
26
|
// Skip over nested node_modules folders.
|
package/lib/findPackage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findPackage.js","sourceRoot":"","sources":["../src/findPackage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,aAAa,CAAC;AAIrC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAKC,EACD,OAEC;IAED,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,WAAW,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"findPackage.js","sourceRoot":"","sources":["../src/findPackage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,aAAa,CAAC;AAIrC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAKC,EACD,OAEC;IAED,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,WAAW,GAAG,SAAS,CAAC;IAC5B,MAAM,aAAa,GAAG,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAEnE,GAAG,CAAC;QACF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC;QAEzE,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;QAC9E,CAAC;QAED,mDAAmD;QACnD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAExC,oDAAoD;QACpD,gGAAgG;QAChG,yFAAyF;QACzF,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACjE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC;QAED,yCAAyC;QACzC,IAAI,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YACzC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI,WAAW,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE;IAE5G,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import path from 'path';\nimport fsPromises from 'fs/promises';\nimport type { PackageJson } from '@ms-cloudpack/config-types';\nimport type { PackageDefinitionsCache, PackageImporterContext } from '@ms-cloudpack/bundler-types';\n\n/**\n * Find the package.json contents for `dependencyName`, searching up under `node_modules` folders\n * starting at `startPath` and ending at `rootPath` (usually the git root) or the filesystem root.\n */\nexport async function findPackage(\n options: {\n dependencyName: string;\n startPath: string;\n importerContext?: PackageImporterContext;\n rootPath?: string;\n },\n context: {\n packages: PackageDefinitionsCache;\n },\n): Promise<{ packagePath: string; definition: PackageJson } | undefined> {\n const { dependencyName, rootPath, startPath, importerContext } = options;\n const { packages } = context;\n\n let packagePath = startPath;\n const isStoreLayout = /[\\\\/]\\.(pnpm|store)[\\\\/]/.test(packagePath);\n\n do {\n const resolvedPath = path.join(packagePath, 'node_modules', dependencyName);\n const definition = await packages.get(resolvedPath, { importerContext });\n\n if (definition) {\n return { packagePath: await fsPromises.realpath(resolvedPath), definition };\n }\n\n // We haven't found it. Try to move up a directory.\n packagePath = path.dirname(packagePath);\n\n // If we moved up into a scope folder, skip over it.\n // Exception: in a manager using a store layout, packages starting with @ are NOT scope folders;\n // e.g. @foo/bar will be in a folder like @foo-bar-npm-1.2.3-abcdef1234 or @foo-bar@1.2.3\n if (!isStoreLayout && path.basename(packagePath).startsWith('@')) {\n packagePath = path.dirname(packagePath);\n }\n\n // Skip over nested node_modules folders.\n if (packagePath.endsWith('node_modules')) {\n packagePath = path.dirname(packagePath);\n }\n } while ((!rootPath || packagePath.length >= rootPath.length) && path.dirname(packagePath) !== packagePath);\n\n return undefined;\n}\n"]}
|
package/lib/getCandidates.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';
|
|
2
|
-
import {} from '@ms-cloudpack/config-types';
|
|
3
2
|
import path from 'path';
|
|
4
3
|
import { isExternalPackage } from './isExternalPackage.js';
|
|
5
4
|
// Mappings to possible candidate extensions for a given input extension.
|
package/lib/getCandidates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCandidates.js","sourceRoot":"","sources":["../src/getCandidates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"getCandidates.js","sourceRoot":"","sources":["../src/getCandidates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;A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,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IACjD,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { type CloudpackConfig } from '@ms-cloudpack/config-types';\nimport path from 'path';\nimport { isExternalPackage } from './isExternalPackage.js';\n\n// Mappings to possible candidate extensions for a given input extension.\nconst externalExtensions = ['.js', '.mjs', '.cjs'];\nconst internalExtensions = ['.ts', '.tsx', '.mts', '.cts', '.jsx', '.js', '.mjs', '.cjs'];\nconst internalExtensionMap: Record<string, string[]> = {\n '.ts': ['.ts', '.js'],\n '.tsx': ['.tsx', '.js'],\n '.mts': ['.mts', '.mjs', '.js'],\n '.cts': ['.cts', '.cjs', '.js'],\n '.jsx': ['.jsx', '.js'],\n '.js': ['.ts', '.tsx', '.mts', '.cts', '.jsx', '.js'],\n '.mjs': ['.mjs', '.js'],\n '.cjs': ['.cjs', '.js'],\n};\nconst externalExtensionMap: Record<string, string[]> = {\n '.ts': ['.js'],\n '.tsx': ['.js'],\n '.mts': ['.mjs'],\n '.cts': ['.cjs'],\n '.jsx': ['.js'],\n '.js': ['.js'],\n};\n\n/**\n * Given a packagePath and a filePath from its exports map (or main/module), build candidate paths\n * to look for the physical file in order of priority. For internal packages, we try to discover\n * source files first, and then fallback to the original file name. We also search for index files\n * and expand folder paths as well for ambiguous references. For external packages, we prioritize\n * intermediate paths.\n */\nexport function getCandidates(\n options: { filePath: string; packagePath: string },\n context: { config: CloudpackConfig },\n) {\n const { filePath, packagePath } = options;\n const resolveWebExtensions = Boolean(context.config.features?.resolveWebExtensions);\n const isBlankPath = !filePath || filePath === '.';\n const originalPath = isBlankPath ? './index' : normalizeRelativePath(filePath);\n const originalExt = path.extname(originalPath);\n const isInternal = !isExternalPackage(packagePath);\n const endsWithSlash = originalPath.endsWith('/');\n const candidates = [];\n const defaultExtensions = isInternal ? internalExtensions : externalExtensions;\n const defaultExtensionsWithSuffixes = resolveWebExtensions\n ? [...defaultExtensions.map((ext) => `.web${ext}`), ...defaultExtensions]\n : defaultExtensions;\n const extensions =\n (isInternal ? internalExtensionMap : externalExtensionMap)[originalExt] || defaultExtensionsWithSuffixes;\n const pathsToAdd = [originalPath];\n\n if (isInternal && originalPath.startsWith('./lib')) {\n pathsToAdd.unshift(originalPath.replace(/^\\.\\/lib/, './src'));\n }\n\n for (let currentPath of pathsToAdd) {\n const unrecognizedExt = originalExt && !extensions.includes(path.extname(currentPath));\n\n // For internal packages, we try and resolve the original file name first.\n if (isInternal && unrecognizedExt) {\n candidates.push(currentPath);\n }\n\n // If the path doesn't end with a slash, it could be a file. Add extensions.\n if (!endsWithSlash) {\n candidates.push(...expandExtensions(currentPath, extensions));\n }\n\n // For non-extension references, we might be referring to a folder, or a barrel file within a folder. Add the\n // appropriate extensions for the barrel file, and fall back to a package.json in the case of nested definitions.\n if (!originalExt) {\n if (isBlankPath) {\n candidates.push('./package.json');\n } else {\n // Trim trailing slash\n if (endsWithSlash) {\n currentPath = currentPath.slice(0, -1);\n }\n\n candidates.push(...expandExtensions(currentPath + '/index', extensions));\n candidates.push(currentPath + '/package.json');\n }\n }\n\n // For external packages, we try and resolve the original file name last.\n if (!isInternal && unrecognizedExt) {\n candidates.push(currentPath);\n }\n }\n\n return candidates;\n}\n\n/**\n * Given a filepath and list of extensions, maps extensions to prepend the filepath. In the case that\n * the filepath has an extension already in the list, avoids appending the extension twice.\n *\n * For example, filePath = './foo/bar.js' with extensions ['.ts', '.js'] would result in:\n *\n * ['./foo/bar.ts.js', './foo/bar.js'].\n *\n */\nfunction expandExtensions(filePath: string, extensions: string[]) {\n const result: string[] = [];\n const ext = path.extname(filePath);\n\n if (extensions.includes(ext)) {\n filePath = `${filePath.slice(0, -ext.length)}`;\n }\n\n for (const currentExt of extensions) {\n result.push(filePath + currentExt);\n }\n\n return result;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the displayable version of the package which contains the import url provided. If the package
|
|
3
|
+
* is a local package rather than a node_modules external package, we display the version as "0.0.0-local"
|
|
4
|
+
* with the path following it.
|
|
5
|
+
* @param importUrl - import.meta.url
|
|
6
|
+
* @returns - the version of the package. If the package is not in node_modules, it returns "0.0.0-local".
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDisplayVersion(importUrl: string): string;
|
|
9
|
+
//# sourceMappingURL=getDisplayVersion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDisplayVersion.d.ts","sourceRoot":"","sources":["../src/getDisplayVersion.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getVersionInternal } from './getVersionInternal.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the displayable version of the package which contains the import url provided. If the package
|
|
4
|
+
* is a local package rather than a node_modules external package, we display the version as "0.0.0-local"
|
|
5
|
+
* with the path following it.
|
|
6
|
+
* @param importUrl - import.meta.url
|
|
7
|
+
* @returns - the version of the package. If the package is not in node_modules, it returns "0.0.0-local".
|
|
8
|
+
*/
|
|
9
|
+
export function getDisplayVersion(importUrl) {
|
|
10
|
+
const { version, isExternal, packagePath } = getVersionInternal(importUrl);
|
|
11
|
+
return isExternal ? version : `${version} ${packagePath}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=getDisplayVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDisplayVersion.js","sourceRoot":"","sources":["../src/getDisplayVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC3E,OAAO,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["import { getVersionInternal } from './getVersionInternal.js';\n\n/**\n * Returns the displayable version of the package which contains the import url provided. If the package\n * is a local package rather than a node_modules external package, we display the version as \"0.0.0-local\"\n * with the path following it.\n * @param importUrl - import.meta.url\n * @returns - the version of the package. If the package is not in node_modules, it returns \"0.0.0-local\".\n */\nexport function getDisplayVersion(importUrl: string): string {\n const { version, isExternal, packagePath } = getVersionInternal(importUrl);\n return isExternal ? version : `${version} ${packagePath}`;\n}\n"]}
|
package/lib/getVersion.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns the
|
|
3
|
-
* is a local package rather than a node_modules external package, we display the version as "0.0.0-local"
|
|
4
|
-
* with the path following it.
|
|
2
|
+
* Returns the version of the package which contains the import url provided.
|
|
5
3
|
* @param importUrl - import.meta.url
|
|
6
|
-
* @returns - the version of the package.
|
|
4
|
+
* @returns - the version of the package.
|
|
7
5
|
*/
|
|
8
6
|
export declare function getVersion(importUrl: string): string;
|
|
9
7
|
//# sourceMappingURL=getVersion.d.ts.map
|
package/lib/getVersion.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVersion.d.ts","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getVersion.d.ts","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
package/lib/getVersion.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { findPackageRoot } from '@ms-cloudpack/path-utilities';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import { isExternalPackage } from './isExternalPackage.js';
|
|
1
|
+
import { getVersionInternal } from './getVersionInternal.js';
|
|
6
2
|
/**
|
|
7
|
-
* Returns the
|
|
8
|
-
* is a local package rather than a node_modules external package, we display the version as "0.0.0-local"
|
|
9
|
-
* with the path following it.
|
|
3
|
+
* Returns the version of the package which contains the import url provided.
|
|
10
4
|
* @param importUrl - import.meta.url
|
|
11
|
-
* @returns - the version of the package.
|
|
5
|
+
* @returns - the version of the package.
|
|
12
6
|
*/
|
|
13
7
|
export function getVersion(importUrl) {
|
|
14
|
-
|
|
15
|
-
let version = `0.0.0-local ${packagePath}`;
|
|
16
|
-
if (packagePath && isExternalPackage(packagePath)) {
|
|
17
|
-
const packageJSONpath = path.join(packagePath, 'package.json');
|
|
18
|
-
// eslint-disable-next-line @ms-cloudpack/internal/no-sync-filesystem
|
|
19
|
-
version = readJsonSync(packageJSONpath).version || version;
|
|
20
|
-
}
|
|
21
|
-
return version;
|
|
8
|
+
return getVersionInternal(importUrl).version;
|
|
22
9
|
}
|
|
23
10
|
//# sourceMappingURL=getVersion.js.map
|
package/lib/getVersion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVersion.js","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getVersion.js","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;GAIG;AAEH,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;AAC/C,CAAC","sourcesContent":["import { getVersionInternal } from './getVersionInternal.js';\n\n/**\n * Returns the version of the package which contains the import url provided.\n * @param importUrl - import.meta.url\n * @returns - the version of the package.\n */\n\nexport function getVersion(importUrl: string): string {\n return getVersionInternal(importUrl).version;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVersionInternal.d.ts","sourceRoot":"","sources":["../src/getVersionInternal.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAapH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { readJsonSync } from '@ms-cloudpack/json-utilities';
|
|
2
|
+
import { findPackageRoot } from '@ms-cloudpack/path-utilities';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { isExternalPackage } from './isExternalPackage.js';
|
|
6
|
+
export function getVersionInternal(importUrl) {
|
|
7
|
+
const packagePath = findPackageRoot(path.dirname(fileURLToPath(importUrl)));
|
|
8
|
+
const result = { version: `0.0.0-local`, packagePath, isExternal: false };
|
|
9
|
+
if (packagePath && isExternalPackage(packagePath)) {
|
|
10
|
+
const packageJSONpath = path.join(packagePath, 'package.json');
|
|
11
|
+
// eslint-disable-next-line @ms-cloudpack/internal/no-sync-filesystem
|
|
12
|
+
result.version = readJsonSync(packageJSONpath).version || result.version;
|
|
13
|
+
result.isExternal = true;
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=getVersionInternal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVersionInternal.js","sourceRoot":"","sources":["../src/getVersionInternal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAE1E,IAAI,WAAW,IAAI,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;QAClD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAE/D,qEAAqE;QACrE,MAAM,CAAC,OAAO,GAAI,YAAY,CAAC,eAAe,CAAiB,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC;QAC1F,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/config-types';\nimport { readJsonSync } from '@ms-cloudpack/json-utilities';\nimport { findPackageRoot } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { isExternalPackage } from './isExternalPackage.js';\n\nexport function getVersionInternal(importUrl: string): { version: string; packagePath?: string; isExternal: boolean } {\n const packagePath = findPackageRoot(path.dirname(fileURLToPath(importUrl)));\n const result = { version: `0.0.0-local`, packagePath, isExternal: false };\n\n if (packagePath && isExternalPackage(packagePath)) {\n const packageJSONpath = path.join(packagePath, 'package.json');\n\n // eslint-disable-next-line @ms-cloudpack/internal/no-sync-filesystem\n result.version = (readJsonSync(packageJSONpath) as PackageJson).version || result.version;\n result.isExternal = true;\n }\n\n return result;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { resolve } from './resolve.js';
|
|
|
14
14
|
export { detectModuleType, type ModuleType } from './detectModuleType.js';
|
|
15
15
|
export { isExternalPackage } from './isExternalPackage.js';
|
|
16
16
|
export { findFileInPackage, type FindFileInPackageOptions, type FindFileInPackageResult } from './findFileInPackage.js';
|
|
17
|
+
export { getDisplayVersion } from './getDisplayVersion.js';
|
|
17
18
|
export { getVersion } from './getVersion.js';
|
|
18
19
|
export { getDependencies } from './getDependencies.js';
|
|
19
20
|
export { getUnusedDependencies } from './getUnusedDependencies.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC1G,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EA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E,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { resolve } from './resolve.js';
|
|
|
15
15
|
export { detectModuleType } from './detectModuleType.js';
|
|
16
16
|
export { isExternalPackage } from './isExternalPackage.js';
|
|
17
17
|
export { findFileInPackage } from './findFileInPackage.js';
|
|
18
|
+
export { getDisplayVersion } from './getDisplayVersion.js';
|
|
18
19
|
export { getVersion } from './getVersion.js';
|
|
19
20
|
export { getDependencies } from './getDependencies.js';
|
|
20
21
|
export { getUnusedDependencies } from './getUnusedDependencies.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,kCAAkC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAkC,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,8BAA8B;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,0BAA0B;AAC1B,OAAO,EAAE,gBAAgB,EAAmB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAA+D,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["// Package definition parsing\nexport { PackageDefinitions } from './PackageDefinitions.js';\n\n// ResolveMap creation\nexport { createResolveMap } from './createResolveMap/createResolveMap.js';\nexport type { ResolveMap } from './types/ResolveMap.js';\nexport type { ResolveMapEntry } from './types/ResolveMapEntry.js';\nexport { findResolveMapEntry } from './findResolveMapEntry.js';\nexport type { DiffResolveMapsChanges, DiffResolveMapsStats } from './createResolveMap/diffResolveMaps.js';\nexport { diffResolveMaps } from './createResolveMap/diffResolveMaps.js';\nexport type { LinkedPath } from './types/LinkedPath.js';\n\n// ExportsMap parsing and creation\nexport { flattenExportsMap } from './flattenExportsMap.js';\nexport { createExportsMap } from './createExportsMap.js';\nexport { addExportsMapEntry, type AddExportsMapEntryOptions } from './addExportsMapEntry.js';\nexport { getExportsMap } from './getExportsMap.js';\n\n// Import resolution utilities\nexport { resolve } from './resolve.js';\n\n// Other package utilities\nexport { detectModuleType, type ModuleType } from './detectModuleType.js';\nexport { isExternalPackage } from './isExternalPackage.js';\nexport { findFileInPackage, type FindFileInPackageOptions, type FindFileInPackageResult } from './findFileInPackage.js';\nexport { getVersion } from './getVersion.js';\nexport { getDependencies } from './getDependencies.js';\nexport { getUnusedDependencies } from './getUnusedDependencies.js';\nexport { findProjectRoot } from './findProjectRoot.js';\nexport { shouldExternalizePackage } from './shouldExternalizePackage.js';\nexport { ensurePackageJsonDependencies } from './ensurePackageJsonDependencies.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,kCAAkC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAkC,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,8BAA8B;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,0BAA0B;AAC1B,OAAO,EAAE,gBAAgB,EAAmB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAA+D,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["// Package definition parsing\nexport { PackageDefinitions } from './PackageDefinitions.js';\n\n// ResolveMap creation\nexport { createResolveMap } from './createResolveMap/createResolveMap.js';\nexport type { ResolveMap } from './types/ResolveMap.js';\nexport type { ResolveMapEntry } from './types/ResolveMapEntry.js';\nexport { findResolveMapEntry } from './findResolveMapEntry.js';\nexport type { DiffResolveMapsChanges, DiffResolveMapsStats } from './createResolveMap/diffResolveMaps.js';\nexport { diffResolveMaps } from './createResolveMap/diffResolveMaps.js';\nexport type { LinkedPath } from './types/LinkedPath.js';\n\n// ExportsMap parsing and creation\nexport { flattenExportsMap } from './flattenExportsMap.js';\nexport { createExportsMap } from './createExportsMap.js';\nexport { addExportsMapEntry, type AddExportsMapEntryOptions } from './addExportsMapEntry.js';\nexport { getExportsMap } from './getExportsMap.js';\n\n// Import resolution utilities\nexport { resolve } from './resolve.js';\n\n// Other package utilities\nexport { detectModuleType, type ModuleType } from './detectModuleType.js';\nexport { isExternalPackage } from './isExternalPackage.js';\nexport { findFileInPackage, type FindFileInPackageOptions, type FindFileInPackageResult } from './findFileInPackage.js';\nexport { getDisplayVersion } from './getDisplayVersion.js';\nexport { getVersion } from './getVersion.js';\nexport { getDependencies } from './getDependencies.js';\nexport { getUnusedDependencies } from './getUnusedDependencies.js';\nexport { findProjectRoot } from './findProjectRoot.js';\nexport { shouldExternalizePackage } from './shouldExternalizePackage.js';\nexport { ensurePackageJsonDependencies } from './ensurePackageJsonDependencies.js';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/package-utilities",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Utilities for resolving/parsing packages and their imports.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ms-cloudpack/bundler-types": "^0.25.
|
|
18
|
-
"@ms-cloudpack/config-types": "^0.
|
|
17
|
+
"@ms-cloudpack/bundler-types": "^0.25.2",
|
|
18
|
+
"@ms-cloudpack/config-types": "^0.7.0",
|
|
19
19
|
"@ms-cloudpack/json-utilities": "^0.1.4",
|
|
20
|
-
"@ms-cloudpack/package-overrides": "^0.6.
|
|
21
|
-
"@ms-cloudpack/path-utilities": "^2.6.1",
|
|
20
|
+
"@ms-cloudpack/package-overrides": "^0.6.24",
|
|
22
21
|
"@ms-cloudpack/path-string-parsing": "^1.2.1",
|
|
22
|
+
"@ms-cloudpack/path-utilities": "^2.6.1",
|
|
23
23
|
"acorn": "^8.11.2",
|
|
24
24
|
"acorn-walk": "^8.2.1",
|
|
25
25
|
"fast-glob": "^3.2.12",
|