@ms-cloudpack/api-server 0.41.0 → 0.42.1
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/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +1 -5
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/common/createSession.d.ts +3 -6
- package/lib/common/createSession.d.ts.map +1 -1
- package/lib/common/createSession.js +12 -12
- package/lib/common/createSession.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/startApiServer.d.ts.map +1 -1
- package/lib/startApiServer.js +5 -1
- package/lib/startApiServer.js.map +1 -1
- package/lib/trpc/createCloudpackClient.d.ts +1 -1
- package/lib/trpc/createCloudpackClient.d.ts.map +1 -1
- package/lib/trpc/createCloudpackClient.js +3 -3
- package/lib/trpc/createCloudpackClient.js.map +1 -1
- package/lib/trpc/httpAdapter.d.ts.map +1 -1
- package/lib/trpc/httpAdapter.js +2 -1
- package/lib/trpc/httpAdapter.js.map +1 -1
- package/lib/types/Context.d.ts +8 -0
- package/lib/types/Context.d.ts.map +1 -1
- package/lib/types/Context.js.map +1 -1
- package/lib/types/Session.d.ts +8 -0
- package/lib/types/Session.d.ts.map +1 -1
- package/lib/types/Session.js.map +1 -1
- package/lib/utilities/addOverride.d.ts.map +1 -1
- package/lib/utilities/addOverride.js +3 -3
- package/lib/utilities/addOverride.js.map +1 -1
- package/lib/utilities/bundleTask.d.ts +8 -16
- package/lib/utilities/bundleTask.d.ts.map +1 -1
- package/lib/utilities/bundleTask.js +105 -115
- package/lib/utilities/bundleTask.js.map +1 -1
- package/lib/utilities/createBundleTask.d.ts +5 -21
- package/lib/utilities/createBundleTask.d.ts.map +1 -1
- package/lib/utilities/createBundleTask.js +9 -23
- package/lib/utilities/createBundleTask.js.map +1 -1
- package/lib/utilities/getSessionPath.d.ts +3 -0
- package/lib/utilities/getSessionPath.d.ts.map +1 -0
- package/lib/utilities/getSessionPath.js +6 -0
- package/lib/utilities/getSessionPath.js.map +1 -0
- package/lib/utilities/resolveDependenciesTask.d.ts +3 -7
- package/lib/utilities/resolveDependenciesTask.d.ts.map +1 -1
- package/lib/utilities/resolveDependenciesTask.js +2 -8
- package/lib/utilities/resolveDependenciesTask.js.map +1 -1
- package/lib/utilities/validateOverride.d.ts.map +1 -1
- package/lib/utilities/validateOverride.js +4 -3
- package/lib/utilities/validateOverride.js.map +1 -1
- package/package.json +10 -10
- package/lib/utilities/parseRequestInfo.d.ts +0 -30
- package/lib/utilities/parseRequestInfo.d.ts.map +0 -1
- package/lib/utilities/parseRequestInfo.js +0 -34
- package/lib/utilities/parseRequestInfo.js.map +0 -1
- package/lib/utilities/parseRequestUrl.d.ts +0 -14
- package/lib/utilities/parseRequestUrl.d.ts.map +0 -1
- package/lib/utilities/parseRequestUrl.js +0 -24
- package/lib/utilities/parseRequestUrl.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveDependenciesTask.d.ts","sourceRoot":"","sources":["../../src/utilities/resolveDependenciesTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveDependenciesTask.d.ts","sourceRoot":"","sources":["../../src/utilities/resolveDependenciesTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAmB,MAAM,iCAAiC,CAAC;AAG/F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE;IACP,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B,EACD,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAAC,GAC9C,OAAO,CAAC,UAAU,CAAC,CAyCrB"}
|
|
@@ -2,7 +2,7 @@ import { createResolveMap } from '@ms-cloudpack/package-utilities';
|
|
|
2
2
|
import { bold, bulletedList, cyan, yellow } from '@ms-cloudpack/task-reporter';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves the locations of dependencies and returns the resolve map, logging results
|
|
5
|
-
* to the task reporter.
|
|
5
|
+
* to the task reporter. Throws if dependencies could not be resolved.
|
|
6
6
|
*/
|
|
7
7
|
export async function resolveDependenciesTask(options, context) {
|
|
8
8
|
const { appPath, additionalPaths, linkedPaths } = options;
|
|
@@ -11,13 +11,7 @@ export async function resolveDependenciesTask(options, context) {
|
|
|
11
11
|
// Grab the installed dependency locations.
|
|
12
12
|
const task = reporter.addTask('Resolving dependencies');
|
|
13
13
|
try {
|
|
14
|
-
resolveMap = await createResolveMap({
|
|
15
|
-
appPath,
|
|
16
|
-
additionalPaths,
|
|
17
|
-
linkedPaths,
|
|
18
|
-
}, {
|
|
19
|
-
packages,
|
|
20
|
-
});
|
|
14
|
+
resolveMap = await createResolveMap({ appPath, additionalPaths, linkedPaths }, { packages });
|
|
21
15
|
const { allPackages, duplicatedPackages } = getPackagesFromResolveMap(resolveMap);
|
|
22
16
|
const message = `Found ${cyan(allPackages.size)} total packages, ${duplicatedPackages.size ? `${yellow(duplicatedPackages.size)} with multiple versions.` : `no duplicates.`}`;
|
|
23
17
|
const extended = bulletedList(Array.from(duplicatedPackages.entries()).map(([name, versions]) => `${bold(name)}: ${Array.from(versions).join(', ')}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveDependenciesTask.js","sourceRoot":"","sources":["../../src/utilities/resolveDependenciesTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveDependenciesTask.js","sourceRoot":"","sources":["../../src/utilities/resolveDependenciesTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC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Y,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,QAAQ,CAAC,YAAY,CAAC,CAAC;QAEvB,IAAI,YAAY,CAAC,cAAc,EAAE,CAAC;YAChC,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;gBACrE,QAAQ,CAAC,WAAW,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,WAAW;QACX,kBAAkB;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import type { LinkedPath, ResolveMap, ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { createResolveMap } from '@ms-cloudpack/package-utilities';\nimport { bold, bulletedList, cyan, yellow } from '@ms-cloudpack/task-reporter';\nimport type { Context } from '../types/Context.js';\n\n/**\n * Resolves the locations of dependencies and returns the resolve map, logging results\n * to the task reporter. Throws if dependencies could not be resolved.\n */\nexport async function resolveDependenciesTask(\n options: {\n appPath: string;\n additionalPaths?: string[];\n linkedPaths?: LinkedPath[];\n },\n context: Pick<Context, 'reporter' | 'packages'>,\n): Promise<ResolveMap> {\n const { appPath, additionalPaths, linkedPaths } = options;\n const { reporter, packages } = context;\n let resolveMap: ResolveMap | undefined;\n\n // Grab the installed dependency locations.\n const task = reporter.addTask('Resolving dependencies');\n\n try {\n resolveMap = await createResolveMap({ appPath, additionalPaths, linkedPaths }, { packages });\n\n const { allPackages, duplicatedPackages } = getPackagesFromResolveMap(resolveMap);\n const message = `Found ${cyan(allPackages.size)} total packages, ${\n duplicatedPackages.size ? `${yellow(duplicatedPackages.size)} with multiple versions.` : `no duplicates.`\n }`;\n const extended = bulletedList(\n Array.from(duplicatedPackages.entries()).map(\n ([name, versions]) => `${bold(name)}: ${Array.from(versions).join(', ')}`,\n ),\n );\n\n task.complete({ message, extended, forceShow: true });\n\n return resolveMap;\n } catch (err) {\n task.complete({\n status: 'fail',\n message: 'Failed to resolve dependencies',\n errors: [String(err)],\n forceShow: true,\n // Don't use the message as \"details\" because this will cause the message to be logged twice\n extended: (err as Error).stack,\n });\n\n if (err instanceof Error) {\n // Remove the call stack because we already logged it in the extended details of the task\n err.stack = undefined;\n }\n\n throw err;\n }\n}\n\n/**\n * Given a resolveMap, returns a map of all packages and a map of packages with multiple versions.\n * This is used to log the results of the resolve task.\n */\nfunction getPackagesFromResolveMap(resolveMap: ResolveMap) {\n const allPackages = new Map<string, ResolveMapEntry>();\n const duplicatedPackages = new Map<string, Set<string>>();\n\n function addEntry(entry: ResolveMapEntry) {\n const existingEntry = allPackages.get(entry.name);\n if (existingEntry) {\n let dupeSet = duplicatedPackages.get(entry.name);\n if (!dupeSet) {\n dupeSet = new Set([existingEntry.version]);\n duplicatedPackages.set(entry.name, dupeSet);\n }\n dupeSet.add(entry.version);\n } else {\n allPackages.set(entry.name, entry);\n }\n }\n\n for (const currentEntry of Object.values(resolveMap)) {\n addEntry(currentEntry);\n\n if (currentEntry.scopedVersions) {\n for (const scopedEntry of Object.values(currentEntry.scopedVersions)) {\n addEntry(scopedEntry);\n }\n }\n }\n\n return {\n allPackages,\n duplicatedPackages,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/validateOverride.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/validateOverride.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,UAAU,CAAC,GAC7C,OAAO,CAAC,OAAO,CAAC,CA6BlB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { parseRequestInfo } from '@ms-cloudpack/import-map';
|
|
2
|
+
import { findFileInPackage, findResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
3
|
+
import { makeUrl } from '@ms-cloudpack/path-string-parsing';
|
|
3
4
|
/**
|
|
4
5
|
* Given a package name, import path, and optional issuerUrl, returns a boolean indicating if the given
|
|
5
6
|
* override is valid.
|
|
@@ -9,7 +10,7 @@ export async function validateOverride(options, context) {
|
|
|
9
10
|
const { session, packages } = context;
|
|
10
11
|
let definition = undefined;
|
|
11
12
|
if (issuerUrl) {
|
|
12
|
-
const { packageName: name, version } =
|
|
13
|
+
const { packageName: name, version } = parseRequestInfo(makeUrl(issuerUrl).pathname);
|
|
13
14
|
definition = { name, version };
|
|
14
15
|
}
|
|
15
16
|
const entry = findResolveMapEntry({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOverride.js","sourceRoot":"","sources":["../../src/utilities/validateOverride.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateOverride.js","sourceRoot":"","sources":["../../src/utilities/validateOverride.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAI5D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAwB,EACxB,OAA8C;IAE9C,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACvD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACtC,IAAI,UAAU,GAA4B,SAAS,CAAC;IAEpD,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrF,UAAU,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,KAAK,GAAG,mBAAmB,CAAC;QAChC,WAAW;QACX,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAC1C;QACE,WAAW,EAAE,KAAK,CAAC,IAAI;QACvB,QAAQ,EAAE,UAAU;KACrB,EACD,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CACrC,CAAC;IAEF,OAAO,CAAC,CAAC,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/common-types';\nimport { parseRequestInfo } from '@ms-cloudpack/import-map';\nimport { findFileInPackage, findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport type { Context } from '../types/Context.js';\nimport type { OverrideOptions } from '../types/OverrideOptions.js';\n\n/**\n * Given a package name, import path, and optional issuerUrl, returns a boolean indicating if the given\n * override is valid.\n */\nexport async function validateOverride(\n options: OverrideOptions,\n context: Pick<Context, 'session' | 'packages'>,\n): Promise<boolean> {\n const { packageName, importPath, issuerUrl } = options;\n const { session, packages } = context;\n let definition: PackageJson | undefined = undefined;\n\n if (issuerUrl) {\n const { packageName: name, version } = parseRequestInfo(makeUrl(issuerUrl).pathname);\n definition = { name, version };\n }\n\n const entry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n definition,\n });\n\n if (!entry) {\n return false;\n }\n\n const { filePath } = await findFileInPackage(\n {\n packagePath: entry.path,\n filePath: importPath,\n },\n { packages, config: session.config },\n );\n\n return !!filePath;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/api-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "An implementation of the API server that does interacts with a task scheduler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"@lage-run/logger": "^1.3.0",
|
|
28
28
|
"@lage-run/scheduler": "^1.1.9",
|
|
29
29
|
"@lage-run/target-graph": "^0.8.9",
|
|
30
|
-
"@ms-cloudpack/bundler": "^0.20.
|
|
31
|
-
"@ms-cloudpack/common-types": "^0.
|
|
32
|
-
"@ms-cloudpack/config": "^0.20.
|
|
33
|
-
"@ms-cloudpack/create-express-app": "^1.6.
|
|
30
|
+
"@ms-cloudpack/bundler": "^0.20.6",
|
|
31
|
+
"@ms-cloudpack/common-types": "^0.5.0",
|
|
32
|
+
"@ms-cloudpack/config": "^0.20.3",
|
|
33
|
+
"@ms-cloudpack/create-express-app": "^1.6.10",
|
|
34
34
|
"@ms-cloudpack/data-bus": "^0.4.2",
|
|
35
35
|
"@ms-cloudpack/file-watcher": "^0.1.2",
|
|
36
|
-
"@ms-cloudpack/import-map": "^0.
|
|
36
|
+
"@ms-cloudpack/import-map": "^0.4.0",
|
|
37
37
|
"@ms-cloudpack/json-utilities": "^0.1.4",
|
|
38
|
-
"@ms-cloudpack/package-hashes": "^0.5.
|
|
39
|
-
"@ms-cloudpack/package-utilities": "^7.4.
|
|
40
|
-
"@ms-cloudpack/path-string-parsing": "^1.2.
|
|
41
|
-
"@ms-cloudpack/path-utilities": "^2.7.
|
|
38
|
+
"@ms-cloudpack/package-hashes": "^0.5.14",
|
|
39
|
+
"@ms-cloudpack/package-utilities": "^7.4.2",
|
|
40
|
+
"@ms-cloudpack/path-string-parsing": "^1.2.2",
|
|
41
|
+
"@ms-cloudpack/path-utilities": "^2.7.7",
|
|
42
42
|
"@ms-cloudpack/remote-cache": "^0.7.2",
|
|
43
43
|
"@ms-cloudpack/task-reporter": "^0.14.0",
|
|
44
44
|
"@ms-cloudpack/telemetry": "^0.5.1",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a request for package file from the bundle server, such as
|
|
3
|
-
* `/@scope/package@version/v3.2/bundled/path/to/file.js`
|
|
4
|
-
*
|
|
5
|
-
* Segments:
|
|
6
|
-
* - Package name (and optionally `@version`)
|
|
7
|
-
* - Optional refresh version `v#.#`
|
|
8
|
-
* - Optional type `bundled` or `unbundled` (defaults to unbundled)
|
|
9
|
-
* - Optional property `missing` (defaults to false)
|
|
10
|
-
* - Optional file path with leading slash (empty if no path)
|
|
11
|
-
*
|
|
12
|
-
* @param requestPath Pathname (server-relative URL) of the requested file.
|
|
13
|
-
* @returns Info about the requested file. If `requestPath` doesn't follow the expected format,
|
|
14
|
-
* the object will contain empty strings.
|
|
15
|
-
*/
|
|
16
|
-
export declare function parseRequestInfo(requestPath: string): {
|
|
17
|
-
/** Package name (empty string if invalid request) */
|
|
18
|
-
packageName: string;
|
|
19
|
-
/** Optional package version (default: empty string) */
|
|
20
|
-
version: string;
|
|
21
|
-
/** Optional hash (default: empty string) */
|
|
22
|
-
hash: string;
|
|
23
|
-
/** Whether the bundled version is requested (default: false) */
|
|
24
|
-
bundled: boolean;
|
|
25
|
-
/** Optional file path (default: empty string) */
|
|
26
|
-
filePath: string;
|
|
27
|
-
/** Whether the file is missing (default: false) */
|
|
28
|
-
missing: boolean;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=parseRequestInfo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRequestInfo.d.ts","sourceRoot":"","sources":["../../src/utilities/parseRequestInfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG;IACrD,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,EAAE,OAAO,CAAC;CAClB,CAoBA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a request for package file from the bundle server, such as
|
|
3
|
-
* `/@scope/package@version/v3.2/bundled/path/to/file.js`
|
|
4
|
-
*
|
|
5
|
-
* Segments:
|
|
6
|
-
* - Package name (and optionally `@version`)
|
|
7
|
-
* - Optional refresh version `v#.#`
|
|
8
|
-
* - Optional type `bundled` or `unbundled` (defaults to unbundled)
|
|
9
|
-
* - Optional property `missing` (defaults to false)
|
|
10
|
-
* - Optional file path with leading slash (empty if no path)
|
|
11
|
-
*
|
|
12
|
-
* @param requestPath Pathname (server-relative URL) of the requested file.
|
|
13
|
-
* @returns Info about the requested file. If `requestPath` doesn't follow the expected format,
|
|
14
|
-
* the object will contain empty strings.
|
|
15
|
-
*/
|
|
16
|
-
export function parseRequestInfo(requestPath) {
|
|
17
|
-
// This is a hot path, and the following things appear to make the regex faster:
|
|
18
|
-
// - /(?:Non-capturing groups)/ where capturing isn't needed
|
|
19
|
-
// - /(Indexed capturing groups)/ instead of /(?<namedGroups>...)/
|
|
20
|
-
// - For character classes containing - , putting the - at the beginning
|
|
21
|
-
// - Anchoring to the beginning of the string with ^
|
|
22
|
-
const matches = requestPath.match(
|
|
23
|
-
// 1 package name 2 hash 3 version refresh 4 bundled or missing 4 file path end or query
|
|
24
|
-
/^\/?((?:@[-\w.]+\/)?[-\w.]+)(?:@([-\w.]+))?(?:\/h-([-0-9a-z.]+))?(?:\/v[\d.]+)?(?:\/(bundled|unbundled|missing))?(\/[-@\w.+/]+)?(?:\?|$)/) || [];
|
|
25
|
-
return {
|
|
26
|
-
packageName: matches[1] || '',
|
|
27
|
-
version: matches[2] || '',
|
|
28
|
-
hash: matches[3] || '',
|
|
29
|
-
bundled: matches[4] === 'bundled',
|
|
30
|
-
filePath: matches[5] || '',
|
|
31
|
-
missing: matches[4] === 'missing',
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=parseRequestInfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRequestInfo.js","sourceRoot":"","sources":["../../src/utilities/parseRequestInfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAclD,gFAAgF;IAChF,4DAA4D;IAC5D,kEAAkE;IAClE,wEAAwE;IACxE,oDAAoD;IACpD,MAAM,OAAO,GACX,WAAW,CAAC,KAAK;IACf,wIAAwI;IACxI,0IAA0I,CAC3I,IAAI,EAAE,CAAC;IAEV,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;QAC7B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;QACzB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,SAAS;QACjC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;QAC1B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,SAAS;KAClC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Parse a request for package file from the bundle server, such as\n * `/@scope/package@version/v3.2/bundled/path/to/file.js`\n *\n * Segments:\n * - Package name (and optionally `@version`)\n * - Optional refresh version `v#.#`\n * - Optional type `bundled` or `unbundled` (defaults to unbundled)\n * - Optional property `missing` (defaults to false)\n * - Optional file path with leading slash (empty if no path)\n *\n * @param requestPath Pathname (server-relative URL) of the requested file.\n * @returns Info about the requested file. If `requestPath` doesn't follow the expected format,\n * the object will contain empty strings.\n */\nexport function parseRequestInfo(requestPath: string): {\n /** Package name (empty string if invalid request) */\n packageName: string;\n /** Optional package version (default: empty string) */\n version: string;\n /** Optional hash (default: empty string) */\n hash: string;\n /** Whether the bundled version is requested (default: false) */\n bundled: boolean;\n /** Optional file path (default: empty string) */\n filePath: string;\n /** Whether the file is missing (default: false) */\n missing: boolean;\n} {\n // This is a hot path, and the following things appear to make the regex faster:\n // - /(?:Non-capturing groups)/ where capturing isn't needed\n // - /(Indexed capturing groups)/ instead of /(?<namedGroups>...)/\n // - For character classes containing - , putting the - at the beginning\n // - Anchoring to the beginning of the string with ^\n const matches =\n requestPath.match(\n // 1 package name 2 hash 3 version refresh 4 bundled or missing 4 file path end or query\n /^\\/?((?:@[-\\w.]+\\/)?[-\\w.]+)(?:@([-\\w.]+))?(?:\\/h-([-0-9a-z.]+))?(?:\\/v[\\d.]+)?(?:\\/(bundled|unbundled|missing))?(\\/[-@\\w.+/]+)?(?:\\?|$)/,\n ) || [];\n\n return {\n packageName: matches[1] || '',\n version: matches[2] || '',\n hash: matches[3] || '',\n bundled: matches[4] === 'bundled',\n filePath: matches[5] || '',\n missing: matches[4] === 'missing',\n };\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { parseRequestInfo } from './parseRequestInfo.js';
|
|
2
|
-
/**
|
|
3
|
-
* Parse a complete package file request URL, such as
|
|
4
|
-
* `http://localhost/@scope/package@version/v3.2/bundled/path/to/file.js`.
|
|
5
|
-
* See `parseRequestInfo` for more details.
|
|
6
|
-
*
|
|
7
|
-
* Throws an error if `requestUrl` is not a syntactically valid complete URL.
|
|
8
|
-
*
|
|
9
|
-
* @param requestUrl Full URL of the requested file.
|
|
10
|
-
* @returns Info about the requested file. If `requestUrl` doesn't follow the expected format,
|
|
11
|
-
* the object will contain empty strings.
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseRequestUrl(requestUrl: string): ReturnType<typeof parseRequestInfo>;
|
|
14
|
-
//# sourceMappingURL=parseRequestUrl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRequestUrl.d.ts","sourceRoot":"","sources":["../../src/utilities/parseRequestUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAUvF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { parseRequestInfo } from './parseRequestInfo.js';
|
|
2
|
-
/**
|
|
3
|
-
* Parse a complete package file request URL, such as
|
|
4
|
-
* `http://localhost/@scope/package@version/v3.2/bundled/path/to/file.js`.
|
|
5
|
-
* See `parseRequestInfo` for more details.
|
|
6
|
-
*
|
|
7
|
-
* Throws an error if `requestUrl` is not a syntactically valid complete URL.
|
|
8
|
-
*
|
|
9
|
-
* @param requestUrl Full URL of the requested file.
|
|
10
|
-
* @returns Info about the requested file. If `requestUrl` doesn't follow the expected format,
|
|
11
|
-
* the object will contain empty strings.
|
|
12
|
-
*/
|
|
13
|
-
export function parseRequestUrl(requestUrl) {
|
|
14
|
-
let pathname;
|
|
15
|
-
try {
|
|
16
|
-
pathname = new URL(requestUrl).pathname;
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
// The error for URL parsing failure doesn't include the string, so throw a more helpful error.
|
|
20
|
-
throw new Error(`Invalid URL: ${requestUrl}`);
|
|
21
|
-
}
|
|
22
|
-
return parseRequestInfo(pathname);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=parseRequestUrl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRequestUrl.js","sourceRoot":"","sources":["../../src/utilities/parseRequestUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,+FAA+F;QAC/F,MAAM,IAAI,KAAK,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import { parseRequestInfo } from './parseRequestInfo.js';\n\n/**\n * Parse a complete package file request URL, such as\n * `http://localhost/@scope/package@version/v3.2/bundled/path/to/file.js`.\n * See `parseRequestInfo` for more details.\n *\n * Throws an error if `requestUrl` is not a syntactically valid complete URL.\n *\n * @param requestUrl Full URL of the requested file.\n * @returns Info about the requested file. If `requestUrl` doesn't follow the expected format,\n * the object will contain empty strings.\n */\nexport function parseRequestUrl(requestUrl: string): ReturnType<typeof parseRequestInfo> {\n let pathname: string;\n try {\n pathname = new URL(requestUrl).pathname;\n } catch (err) {\n // The error for URL parsing failure doesn't include the string, so throw a more helpful error.\n throw new Error(`Invalid URL: ${requestUrl}`);\n }\n\n return parseRequestInfo(pathname);\n}\n"]}
|