@ms-cloudpack/config 0.28.3 → 0.28.4
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/resolveModule.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolve a module specifier to a file
|
|
3
|
-
* @returns - The resolved file
|
|
2
|
+
* Resolve a module specifier to a file url (with protocol ie: file:). Throws if it can't be resolved.
|
|
3
|
+
* @returns - The resolved file url as a string.
|
|
4
4
|
*/
|
|
5
5
|
export declare function resolveModule(params: {
|
|
6
6
|
importSpecifier: string;
|
package/lib/resolveModule.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { moduleResolve } from 'import-meta-resolve';
|
|
2
|
-
import { pathToFileURL
|
|
2
|
+
import { pathToFileURL } from 'url';
|
|
3
3
|
// Conditions used for resolution if the package has an exports map.
|
|
4
4
|
// More could be added later if desired ("default" is implicitly included).
|
|
5
5
|
const conditions = new Set(['import', 'require', 'node']);
|
|
6
6
|
/**
|
|
7
|
-
* Resolve a module specifier to a file
|
|
8
|
-
* @returns - The resolved file
|
|
7
|
+
* Resolve a module specifier to a file url (with protocol ie: file:). Throws if it can't be resolved.
|
|
8
|
+
* @returns - The resolved file url as a string.
|
|
9
9
|
*/
|
|
10
10
|
export function resolveModule(params) {
|
|
11
11
|
const { importSpecifier, parentUrl } = params;
|
|
12
12
|
const resolvedUrl = moduleResolve(importSpecifier, pathToFileURL(parentUrl), conditions);
|
|
13
|
-
return
|
|
13
|
+
return resolvedUrl.toString();
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=resolveModule.js.map
|
package/lib/resolveModule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveModule.js","sourceRoot":"","sources":["../src/resolveModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveModule.js","sourceRoot":"","sources":["../src/resolveModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,oEAAoE;AACpE,2EAA2E;AAC3E,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAsD;IAClF,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAE9C,MAAM,WAAW,GAAG,aAAa,CAAC,eAAe,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;IACzF,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import { moduleResolve } from 'import-meta-resolve';\nimport { pathToFileURL } from 'url';\n\n// Conditions used for resolution if the package has an exports map.\n// More could be added later if desired (\"default\" is implicitly included).\nconst conditions = new Set(['import', 'require', 'node']);\n\n/**\n * Resolve a module specifier to a file url (with protocol ie: file:). Throws if it can't be resolved.\n * @returns - The resolved file url as a string.\n */\nexport function resolveModule(params: { importSpecifier: string; parentUrl: string }): string {\n const { importSpecifier, parentUrl } = params;\n\n const resolvedUrl = moduleResolve(importSpecifier, pathToFileURL(parentUrl), conditions);\n return resolvedUrl.toString();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveParentConfig.d.ts","sourceRoot":"","sources":["../src/resolveParentConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveParentConfig.d.ts","sourceRoot":"","sources":["../src/resolveParentConfig.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,GAAG,SAAS,CAUrB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
1
2
|
import { resolveModule } from './resolveModule.js';
|
|
2
3
|
/**
|
|
3
4
|
* Resolve an import specifier for a parent config file.
|
|
@@ -6,7 +7,7 @@ import { resolveModule } from './resolveModule.js';
|
|
|
6
7
|
export function resolveParentConfig(params) {
|
|
7
8
|
const { importSpecifier } = params;
|
|
8
9
|
try {
|
|
9
|
-
return resolveModule({ importSpecifier, parentUrl: params.configPath });
|
|
10
|
+
return fileURLToPath(resolveModule({ importSpecifier, parentUrl: params.configPath }));
|
|
10
11
|
}
|
|
11
12
|
catch (err) {
|
|
12
13
|
console.warn(`Error resolving config "extends": "${importSpecifier}": ${err.message || err}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveParentConfig.js","sourceRoot":"","sources":["../src/resolveParentConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAKnC;IACC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAEnC,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveParentConfig.js","sourceRoot":"","sources":["../src/resolveParentConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAKnC;IACC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAEnC,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,aAAa,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACzF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,sCAAsC,eAAe,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC;IAC3G,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { fileURLToPath } from 'url';\nimport { resolveModule } from './resolveModule.js';\n\n/**\n * Resolve an import specifier for a parent config file.\n * Returns undefined if it can't be resolved or doesn't exist.\n */\nexport function resolveParentConfig(params: {\n /** Path of the config file being processed. */\n configPath: string;\n /** The import specifier for the parent (extends) config file. */\n importSpecifier: string;\n}): string | undefined {\n const { importSpecifier } = params;\n\n try {\n return fileURLToPath(resolveModule({ importSpecifier, parentUrl: params.configPath }));\n } catch (err) {\n console.warn(`Error resolving config \"extends\": \"${importSpecifier}\": ${(err as Error).message || err}`);\n }\n\n return undefined;\n}\n"]}
|