@ms-cloudpack/path-string-parsing 1.2.1 → 1.2.2

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/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export { normalizeRelativePath } from './normalizeRelativePath.js';
3
3
  export { slash } from './slash.js';
4
4
  export { parseImportString, type ImportStringResult } from './parseImportString.js';
5
5
  export { parseNamedImports } from './parseNamedImports.js';
6
+ export { makeUrl } from './makeUrl.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
package/lib/index.js CHANGED
@@ -3,4 +3,5 @@ export { normalizeRelativePath } from './normalizeRelativePath.js';
3
3
  export { slash } from './slash.js';
4
4
  export { parseImportString } from './parseImportString.js';
5
5
  export { parseNamedImports } from './parseNamedImports.js';
6
+ export { makeUrl } from './makeUrl.js';
6
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAA2B,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { safeRelativePath } from './safeRelativePath.js';\nexport { normalizeRelativePath } from './normalizeRelativePath.js';\nexport { slash } from './slash.js';\nexport { parseImportString, type ImportStringResult } from './parseImportString.js';\nexport { parseNamedImports } from './parseNamedImports.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAA2B,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { safeRelativePath } from './safeRelativePath.js';\nexport { normalizeRelativePath } from './normalizeRelativePath.js';\nexport { slash } from './slash.js';\nexport { parseImportString, type ImportStringResult } from './parseImportString.js';\nexport { parseNamedImports } from './parseNamedImports.js';\nexport { makeUrl } from './makeUrl.js';\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Attempt to create a URL object from a string, and throw an informative error if it fails.
3
+ * (The URL constructor throws a very generic error.)
4
+ */
5
+ export declare function makeUrl(input: string, base?: string | URL): URL;
6
+ //# sourceMappingURL=makeUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeUrl.d.ts","sourceRoot":"","sources":["../src/makeUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,OAOzD"}
package/lib/makeUrl.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Attempt to create a URL object from a string, and throw an informative error if it fails.
3
+ * (The URL constructor throws a very generic error.)
4
+ */
5
+ export function makeUrl(input, base) {
6
+ try {
7
+ // eslint-disable-next-line no-restricted-syntax -- this is the function definition
8
+ return new URL(input, base);
9
+ }
10
+ catch {
11
+ throw new Error(`Invalid URL: "${input}", base: "${base || ''}"`);
12
+ }
13
+ }
14
+ //# sourceMappingURL=makeUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeUrl.js","sourceRoot":"","sources":["../src/makeUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,IAAmB;IACxD,IAAI,CAAC;QACH,mFAAmF;QACnF,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,aAAa,IAAI,IAAI,EAAE,GAAG,CAAC,CAAC;IACpE,CAAC;AACH,CAAC","sourcesContent":["/**\n * Attempt to create a URL object from a string, and throw an informative error if it fails.\n * (The URL constructor throws a very generic error.)\n */\nexport function makeUrl(input: string, base?: string | URL) {\n try {\n // eslint-disable-next-line no-restricted-syntax -- this is the function definition\n return new URL(input, base);\n } catch {\n throw new Error(`Invalid URL: \"${input}\", base: \"${base || ''}\"`);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/path-string-parsing",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Common path-related string parsing utilities for Cloudpack",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,7 +24,8 @@
24
24
  "test": "cloudpack-scripts test"
25
25
  },
26
26
  "devDependencies": {
27
- "@ms-cloudpack/eslint-plugin-internal": "*"
27
+ "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
28
+ "@ms-cloudpack/scripts": "^0.0.1"
28
29
  },
29
30
  "files": [
30
31
  "lib/**/!(*.test.*)"