@typespec/compiler 1.15.0-dev.5 → 1.15.0-dev.6

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.
Files changed (71) hide show
  1. package/dist/manifest.js +2 -2
  2. package/dist/src/core/cli/actions/init.d.ts +0 -2
  3. package/dist/src/core/cli/actions/init.d.ts.map +1 -1
  4. package/dist/src/core/cli/actions/init.js.map +1 -1
  5. package/dist/src/core/cli/cli.d.ts +1 -15
  6. package/dist/src/core/cli/cli.d.ts.map +1 -1
  7. package/dist/src/core/cli/cli.js +12 -38
  8. package/dist/src/core/cli/cli.js.map +1 -1
  9. package/dist/src/core/cli/utils.d.ts +4 -4
  10. package/dist/src/core/cli/utils.d.ts.map +1 -1
  11. package/dist/src/core/cli/utils.js +6 -6
  12. package/dist/src/core/cli/utils.js.map +1 -1
  13. package/dist/src/core/file-ref.d.ts +26 -0
  14. package/dist/src/core/file-ref.d.ts.map +1 -0
  15. package/dist/src/core/file-ref.js +19 -0
  16. package/dist/src/core/file-ref.js.map +1 -0
  17. package/dist/src/core/types.d.ts +13 -0
  18. package/dist/src/core/types.d.ts.map +1 -1
  19. package/dist/src/core/types.js.map +1 -1
  20. package/dist/src/index.d.ts +1 -0
  21. package/dist/src/index.d.ts.map +1 -1
  22. package/dist/src/index.js +1 -0
  23. package/dist/src/index.js.map +1 -1
  24. package/dist/src/init/core-templates.d.ts +2 -2
  25. package/dist/src/init/core-templates.d.ts.map +1 -1
  26. package/dist/src/init/core-templates.js +2 -2
  27. package/dist/src/init/core-templates.js.map +1 -1
  28. package/dist/src/init/init.d.ts +4 -4
  29. package/dist/src/init/init.d.ts.map +1 -1
  30. package/dist/src/init/init.js +8 -10
  31. package/dist/src/init/init.js.map +1 -1
  32. package/dist/src/init/template-source/default-core-templates.d.ts +9 -0
  33. package/dist/src/init/template-source/default-core-templates.d.ts.map +1 -0
  34. package/dist/src/init/template-source/default-core-templates.js +12 -0
  35. package/dist/src/init/template-source/default-core-templates.js.map +1 -0
  36. package/dist/src/init/template-source/in-memory-template-source.d.ts +8 -10
  37. package/dist/src/init/template-source/in-memory-template-source.d.ts.map +1 -1
  38. package/dist/src/init/template-source/in-memory-template-source.js +22 -19
  39. package/dist/src/init/template-source/in-memory-template-source.js.map +1 -1
  40. package/dist/src/init/template-source/index.d.ts +2 -3
  41. package/dist/src/init/template-source/index.d.ts.map +1 -1
  42. package/dist/src/init/template-source/index.js +2 -3
  43. package/dist/src/init/template-source/index.js.map +1 -1
  44. package/dist/src/init/template-source/types.d.ts +3 -12
  45. package/dist/src/init/template-source/types.d.ts.map +1 -1
  46. package/dist/src/init/template-source/uri-template-source.d.ts +30 -0
  47. package/dist/src/init/template-source/uri-template-source.d.ts.map +1 -0
  48. package/dist/src/init/template-source/uri-template-source.js +45 -0
  49. package/dist/src/init/template-source/uri-template-source.js.map +1 -0
  50. package/dist/src/internals/index.d.ts +1 -1
  51. package/dist/src/internals/index.d.ts.map +1 -1
  52. package/dist/src/internals/index.js +1 -3
  53. package/dist/src/internals/index.js.map +1 -1
  54. package/entrypoints/cli.js +1 -3
  55. package/package.json +2 -6
  56. package/dist/src/init/template-source/file-system-template-source.d.ts +0 -12
  57. package/dist/src/init/template-source/file-system-template-source.d.ts.map +0 -1
  58. package/dist/src/init/template-source/file-system-template-source.js +0 -15
  59. package/dist/src/init/template-source/file-system-template-source.js.map +0 -1
  60. package/dist/src/init/template-source/host-template-source.d.ts +0 -34
  61. package/dist/src/init/template-source/host-template-source.d.ts.map +0 -1
  62. package/dist/src/init/template-source/host-template-source.js +0 -48
  63. package/dist/src/init/template-source/host-template-source.js.map +0 -1
  64. package/dist/src/init/template-source/remote-template-source.d.ts +0 -13
  65. package/dist/src/init/template-source/remote-template-source.d.ts.map +0 -1
  66. package/dist/src/init/template-source/remote-template-source.js +0 -14
  67. package/dist/src/init/template-source/remote-template-source.js.map +0 -1
  68. package/dist/src/internals/standalone.d.ts +0 -15
  69. package/dist/src/internals/standalone.d.ts.map +0 -1
  70. package/dist/src/internals/standalone.js +0 -14
  71. package/dist/src/internals/standalone.js.map +0 -1
@@ -1,39 +1,42 @@
1
- import { joinPaths, normalizePath } from "../../core/path-utils.js";
1
+ import { normalizePath } from "../../core/path-utils.js";
2
2
  import { createSourceFile } from "../../core/source-file.js";
3
- import { SCAFFOLDING_FILENAME } from "./host-template-source.js";
3
+ import { SCAFFOLDING_FILENAME } from "./uri-template-source.js";
4
+ /** Prefix used to label the virtual files this source serves in diagnostics. */
5
+ const INTERNAL_URI_PREFIX = "internal:";
4
6
  /**
5
- * {@link TemplateSource} that serves templates from an in-memory map of POSIX-relative path to file
6
- * contents (e.g. `"scaffolding.json"`, `"emitter-ts/package.json"`). Used by the standalone
7
- * single-executable, which embeds the `templates/` tree as an asset and has no `templates/` dir on
8
- * disk to read.
7
+ * A {@link TemplateSource} serving an index and its template files from an in-memory map keyed by
8
+ * relative path. Used for built-in templates that are bundled rather than on disk — e.g. the
9
+ * standalone single-executable injects one built from its embedded assets. Keys and lookups are
10
+ * normalized so callers can use `./`-relative or backslash paths interchangeably.
9
11
  */
10
12
  export class InMemoryTemplateSource {
11
- baseUri;
12
- files;
13
+ #files;
14
+ #indexPath;
13
15
  /**
14
- * @param files Map of POSIX path (relative to the templates root) to file contents.
15
- * @param baseUri Synthetic base used for the {@link SourceFile} paths (diagnostics/display only).
16
+ * @param files Template files keyed by their relative path (including the index).
17
+ * @param indexPath Relative path of the index within {@link files}.
16
18
  */
17
- constructor(files, baseUri = "/__typespec_templates__") {
18
- this.baseUri = baseUri;
19
- this.files = new Map(Object.entries(files).map(([key, value]) => [normalizeKey(key), value]));
19
+ constructor(files, indexPath = SCAFFOLDING_FILENAME) {
20
+ this.#indexPath = indexPath;
21
+ this.#files = new Map([...files].map(([key, value]) => [normalizeKey(key), value]));
20
22
  }
21
23
  async loadIndex() {
22
- const indexFile = this.readFileSync(SCAFFOLDING_FILENAME);
23
- return { templates: JSON.parse(indexFile.text), indexFile, baseUri: this.baseUri };
24
+ const indexFile = this.#read(this.#indexPath);
25
+ const templates = JSON.parse(indexFile.text);
26
+ return { templates, indexFile, baseUri: INTERNAL_URI_PREFIX };
24
27
  }
25
28
  async readFile(relativePath) {
26
- return this.readFileSync(relativePath);
29
+ return this.#read(relativePath);
27
30
  }
28
- readFileSync(relativePath) {
31
+ #read(relativePath) {
29
32
  const key = normalizeKey(relativePath);
30
- const content = this.files.get(key);
33
+ const content = this.#files.get(key);
31
34
  if (content === undefined) {
32
35
  const error = new Error(`ENOENT: bundled template file not found, '${relativePath}'`);
33
36
  error.code = "ENOENT";
34
37
  throw error;
35
38
  }
36
- return createSourceFile(content, joinPaths(this.baseUri, key));
39
+ return createSourceFile(content, `${INTERNAL_URI_PREFIX}${key}`);
37
40
  }
38
41
  }
39
42
  function normalizeKey(path) {
@@ -1 +1 @@
1
- {"version":3,"file":"in-memory-template-source.js","sourceRoot":"","sources":["../../../../src/init/template-source/in-memory-template-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IASd;IARF,KAAK,CAA8B;IAEpD;;;OAGG;IACH,YACE,KAAuC,EACtB,UAAU,yBAAyB;QAAnC,YAAO,GAAP,OAAO,CAA4B;QAEpD,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;QAC1D,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IACrF,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,YAAoB;QACjC,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAEO,YAAY,CAAC,YAAoB;QACvC,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,KAAK,GAA0B,IAAI,KAAK,CAC5C,6CAA6C,YAAY,GAAG,CAC7D,CAAC;YACF,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;YACtB,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;CACF;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC"}
1
+ {"version":3,"file":"in-memory-template-source.js","sourceRoot":"","sources":["../../../../src/init/template-source/in-memory-template-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAExC;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IACjC,MAAM,CAA8B;IACpC,UAAU,CAAS;IAEnB;;;OAGG;IACH,YAAY,KAAkC,EAAE,YAAoB,oBAAoB;QACtF,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,YAAoB;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,YAAoB;QACxB,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,KAAK,GAA0B,IAAI,KAAK,CAC5C,6CAA6C,YAAY,GAAG,CAC7D,CAAC;YACF,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;YACtB,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,gBAAgB,CAAC,OAAO,EAAE,GAAG,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC"}
@@ -1,6 +1,5 @@
1
- export { CompilerCoreTemplatesRoot, FileSystemTemplateSource, } from "./file-system-template-source.js";
2
- export { UriTemplateSource } from "./host-template-source.js";
1
+ export { defaultInternalTemplateSource } from "./default-core-templates.js";
3
2
  export { InMemoryTemplateSource } from "./in-memory-template-source.js";
4
- export { RemoteTemplateSource } from "./remote-template-source.js";
5
3
  export type { LoadedTemplateIndex, TemplateSource } from "./types.js";
4
+ export { SCAFFOLDING_FILENAME, UriTemplateSource } from "./uri-template-source.js";
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,5 +1,4 @@
1
- export { CompilerCoreTemplatesRoot, FileSystemTemplateSource, } from "./file-system-template-source.js";
2
- export { UriTemplateSource } from "./host-template-source.js";
1
+ export { defaultInternalTemplateSource } from "./default-core-templates.js";
3
2
  export { InMemoryTemplateSource } from "./in-memory-template-source.js";
4
- export { RemoteTemplateSource } from "./remote-template-source.js";
3
+ export { SCAFFOLDING_FILENAME, UriTemplateSource } from "./uri-template-source.js";
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/init/template-source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/init/template-source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -10,21 +10,12 @@ export interface LoadedTemplateIndex {
10
10
  readonly baseUri: string;
11
11
  }
12
12
  /**
13
- * A source of `tsp init` templates.
14
- *
15
- * Decouples template loading from the {@link import("../../core/types.js").CompilerHost} filesystem
16
- * contract: `init` no longer reaches templates through `host.getExecutionRoot()`. Each context
17
- * supplies an implementation instead:
18
- * - {@link import("./file-system-template-source.js").FileSystemTemplateSource} for an installed
19
- * compiler (reads the `templates/` dir off disk),
20
- * - {@link import("./remote-template-source.js").RemoteTemplateSource} for `--templates-url`,
21
- * - {@link import("./in-memory-template-source.js").InMemoryTemplateSource} for the standalone
22
- * single-executable (serves templates embedded as assets).
13
+ * A source of `tsp init` templates. Decouples template loading from the host filesystem: each context
14
+ * supplies its own implementation — {@link UriTemplateSource} for a path or URL, or
15
+ * {@link InMemoryTemplateSource} for a bundle addressed through the `internal:` scheme.
23
16
  */
24
17
  export interface TemplateSource {
25
- /** Load the template index (metadata for every template this source offers). */
26
18
  loadIndex(): Promise<LoadedTemplateIndex>;
27
- /** Read a file referenced by a template, resolved relative to this source. */
28
19
  readFile(relativePath: string): Promise<SourceFile>;
29
20
  }
30
21
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,qGAAqG;AACrG,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACjD,sFAAsF;IACtF,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,gFAAgF;IAChF,SAAS,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACrD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,qGAAqG;AACrG,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACjD,sFAAsF;IACtF,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACrD"}
@@ -0,0 +1,30 @@
1
+ import type { SourceFile, SystemHost } from "../../core/types.js";
2
+ import type { LoadedTemplateIndex, TemplateSource } from "./types.js";
3
+ /** File name of the template index within a template source directory. */
4
+ export declare const SCAFFOLDING_FILENAME = "scaffolding.json";
5
+ /**
6
+ * A {@link TemplateSource} backed by a location: a filesystem path or a URL. The index and every
7
+ * template file are read through a {@link SystemHost} via {@link readUrlOrPath}, so this handles both
8
+ * a local directory and a remote `tsp init <url>` uniformly. Built-in templates are served through
9
+ * {@link defaultInternalTemplateSource} (or an injected provider) instead.
10
+ *
11
+ * Loading an untrusted remote template can execute arbitrary code during scaffolding; callers are
12
+ * responsible for confirming the source with the user before using it.
13
+ */
14
+ export declare class UriTemplateSource implements TemplateSource {
15
+ #private;
16
+ /**
17
+ * @param host Host used to read the index and template files.
18
+ * @param indexLocation Location of the index file (a path or URL). Template files are resolved
19
+ * relative to its containing directory.
20
+ */
21
+ constructor(host: SystemHost, indexLocation: string);
22
+ /**
23
+ * Create a source for a template root directory (path or URL) whose index is a
24
+ * `scaffolding.json` at its root.
25
+ */
26
+ static fromDirectory(host: SystemHost, directory: string): UriTemplateSource;
27
+ loadIndex(): Promise<LoadedTemplateIndex>;
28
+ readFile(relativePath: string): Promise<SourceFile>;
29
+ }
30
+ //# sourceMappingURL=uri-template-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uri-template-source.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/uri-template-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtE,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,YAAW,cAAc;;IAMtD;;;;OAIG;gBACS,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM;IAMnD;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB;IAOtE,SAAS,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAMzC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAG1D"}
@@ -0,0 +1,45 @@
1
+ import { getDirectoryPath } from "../../core/path-utils.js";
2
+ import { readUrlOrPath, resolveRelativeUrlOrPath } from "../../utils/misc.js";
3
+ /** File name of the template index within a template source directory. */
4
+ export const SCAFFOLDING_FILENAME = "scaffolding.json";
5
+ /**
6
+ * A {@link TemplateSource} backed by a location: a filesystem path or a URL. The index and every
7
+ * template file are read through a {@link SystemHost} via {@link readUrlOrPath}, so this handles both
8
+ * a local directory and a remote `tsp init <url>` uniformly. Built-in templates are served through
9
+ * {@link defaultInternalTemplateSource} (or an injected provider) instead.
10
+ *
11
+ * Loading an untrusted remote template can execute arbitrary code during scaffolding; callers are
12
+ * responsible for confirming the source with the user before using it.
13
+ */
14
+ export class UriTemplateSource {
15
+ #host;
16
+ #indexLocation;
17
+ /** Directory (path or URL) that template file paths are resolved against. */
18
+ #baseUri;
19
+ /**
20
+ * @param host Host used to read the index and template files.
21
+ * @param indexLocation Location of the index file (a path or URL). Template files are resolved
22
+ * relative to its containing directory.
23
+ */
24
+ constructor(host, indexLocation) {
25
+ this.#host = host;
26
+ this.#indexLocation = indexLocation;
27
+ this.#baseUri = getDirectoryPath(indexLocation);
28
+ }
29
+ /**
30
+ * Create a source for a template root directory (path or URL) whose index is a
31
+ * `scaffolding.json` at its root.
32
+ */
33
+ static fromDirectory(host, directory) {
34
+ return new UriTemplateSource(host, resolveRelativeUrlOrPath(directory + "/", SCAFFOLDING_FILENAME));
35
+ }
36
+ async loadIndex() {
37
+ const indexFile = await readUrlOrPath(this.#host, this.#indexLocation);
38
+ const templates = JSON.parse(indexFile.text);
39
+ return { templates, indexFile, baseUri: this.#baseUri };
40
+ }
41
+ async readFile(relativePath) {
42
+ return readUrlOrPath(this.#host, resolveRelativeUrlOrPath(this.#baseUri + "/", relativePath));
43
+ }
44
+ }
45
+ //# sourceMappingURL=uri-template-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uri-template-source.js","sourceRoot":"","sources":["../../../../src/init/template-source/uri-template-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IAC5B,KAAK,CAAa;IAClB,cAAc,CAAS;IACvB,6EAA6E;IAC7E,QAAQ,CAAS;IAEjB;;;;OAIG;IACH,YAAY,IAAgB,EAAE,aAAqB;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,IAAgB,EAAE,SAAiB;QACtD,OAAO,IAAI,iBAAiB,CAC1B,IAAI,EACJ,wBAAwB,CAAC,SAAS,GAAG,GAAG,EAAE,oBAAoB,CAAC,CAChE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACvE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,YAAoB;QACjC,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,wBAAwB,CAAC,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC;IAChG,CAAC;CACF"}
@@ -6,8 +6,8 @@ export { resolveCompilerOptions } from "../config/config-to-options.js";
6
6
  export { NodeSystemHost } from "../core/node-system-host.js";
7
7
  export { InitTemplateSchema } from "../init/init-template.js";
8
8
  export { makeScaffoldingConfig, scaffoldNewProject } from "../init/scaffold.js";
9
- export { UriTemplateSource } from "../init/template-source/host-template-source.js";
10
9
  export type { TemplateSource } from "../init/template-source/types.js";
10
+ export { UriTemplateSource } from "../init/template-source/uri-template-source.js";
11
11
  export { resolveEntrypointFile } from "../server/entrypoint-resolver.js";
12
12
  export { InternalCompileResult, ServerDiagnostic } from "../server/index.js";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internals/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internals/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -9,8 +9,6 @@ export { resolveCompilerOptions } from "../config/config-to-options.js";
9
9
  export { NodeSystemHost } from "../core/node-system-host.js";
10
10
  export { InitTemplateSchema } from "../init/init-template.js";
11
11
  export { makeScaffoldingConfig, scaffoldNewProject } from "../init/scaffold.js";
12
- // Imported from host-template-source (not the barrel) to avoid pulling `node-host`'s top-level
13
- // await, which would break browser/CommonJS consumers of `internals`.
14
- export { UriTemplateSource } from "../init/template-source/host-template-source.js";
12
+ export { UriTemplateSource } from "../init/template-source/uri-template-source.js";
15
13
  export { resolveEntrypointFile } from "../server/entrypoint-resolver.js";
16
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internals/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,IAAI,CAAE,UAAkB,CAAC,6BAA6B,EAAE,CAAC;IACvD,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;AAC/F,CAAC;AAED,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAChF,+FAA+F;AAC/F,sEAAsE;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAEpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internals/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,IAAI,CAAE,UAAkB,CAAC,6BAA6B,EAAE,CAAC;IACvD,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;AAC/F,CAAC;AAED,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -2,6 +2,4 @@
2
2
  * File serving as an entrypoint to resolve a local tsp install from a global install.
3
3
  * DO NOT MOVE or this will create a breaking change for user of global cli.
4
4
  */
5
- import { runTypeSpecCli } from "../dist/src/core/cli/cli.js";
6
-
7
- await runTypeSpecCli();
5
+ import "../dist/src/core/cli/cli.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/compiler",
3
- "version": "1.15.0-dev.5",
3
+ "version": "1.15.0-dev.6",
4
4
  "description": "TypeSpec compiler and standard library",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "MIT",
@@ -60,13 +60,9 @@
60
60
  "./internals/prettier-formatter": {
61
61
  "import": "./dist/src/internals/prettier-formatter.js"
62
62
  },
63
- "./internals/standalone": {
64
- "import": "./dist/src/internals/standalone.js"
65
- },
66
63
  "./casing": {
67
64
  "import": "./dist/src/casing/index.js"
68
- },
69
- "./package.json": "./package.json"
65
+ }
70
66
  },
71
67
  "browser": {
72
68
  "./dist/src/core/node-host.js": "./dist/src/core/node-host.browser.js",
@@ -1,12 +0,0 @@
1
- import type { SystemHost } from "../../core/types.js";
2
- import { UriTemplateSource } from "./host-template-source.js";
3
- /** Default location of the compiler's built-in `tsp init` templates. */
4
- export declare const CompilerCoreTemplatesRoot: string;
5
- /**
6
- * {@link TemplateSource} backed by a `templates/` directory on disk, read through the given
7
- * {@link SystemHost}. This is the source used by a normally-installed compiler.
8
- */
9
- export declare class FileSystemTemplateSource extends UriTemplateSource {
10
- constructor(host: SystemHost, rootDir?: string);
11
- }
12
- //# sourceMappingURL=file-system-template-source.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-system-template-source.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/file-system-template-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,wEAAwE;AACxE,eAAO,MAAM,yBAAyB,QAAgD,CAAC;AAEvF;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB;gBACjD,IAAI,EAAE,UAAU,EAAE,OAAO,GAAE,MAAkC;CAG1E"}
@@ -1,15 +0,0 @@
1
- import { CompilerPackageRoot } from "../../core/node-host.js";
2
- import { resolvePath } from "../../core/path-utils.js";
3
- import { UriTemplateSource } from "./host-template-source.js";
4
- /** Default location of the compiler's built-in `tsp init` templates. */
5
- export const CompilerCoreTemplatesRoot = resolvePath(CompilerPackageRoot, "templates");
6
- /**
7
- * {@link TemplateSource} backed by a `templates/` directory on disk, read through the given
8
- * {@link SystemHost}. This is the source used by a normally-installed compiler.
9
- */
10
- export class FileSystemTemplateSource extends UriTemplateSource {
11
- constructor(host, rootDir = CompilerCoreTemplatesRoot) {
12
- super(host, rootDir);
13
- }
14
- }
15
- //# sourceMappingURL=file-system-template-source.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-system-template-source.js","sourceRoot":"","sources":["../../../../src/init/template-source/file-system-template-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,wEAAwE;AACxE,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;AAEvF;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IAC7D,YAAY,IAAgB,EAAE,UAAkB,yBAAyB;QACvE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -1,34 +0,0 @@
1
- import type { SourceFile, SystemHost } from "../../core/types.js";
2
- import type { LoadedTemplateIndex, TemplateSource } from "./types.js";
3
- /** File name of the template index within a template source root. */
4
- export declare const SCAFFOLDING_FILENAME = "scaffolding.json";
5
- /**
6
- * A {@link TemplateSource} that reads through a {@link SystemHost}, resolving files relative to a
7
- * base location (a directory path or a URL). Shared by the filesystem and remote sources, which only
8
- * differ in where their index lives.
9
- */
10
- export declare abstract class HostTemplateSource implements TemplateSource {
11
- protected readonly host: SystemHost;
12
- /** Location of the index file (`scaffolding.json`) — a path or URL. */
13
- private readonly indexLocation;
14
- /** Base against which template file paths are resolved — a directory path or URL. */
15
- private readonly baseUri;
16
- constructor(host: SystemHost,
17
- /** Location of the index file (`scaffolding.json`) — a path or URL. */
18
- indexLocation: string,
19
- /** Base against which template file paths are resolved — a directory path or URL. */
20
- baseUri: string);
21
- loadIndex(): Promise<LoadedTemplateIndex>;
22
- readFile(relativePath: string): Promise<SourceFile>;
23
- }
24
- /** Derive the base directory (path or URL) that a template index at `indexLocation` sits in. */
25
- export declare function baseUriOf(indexLocation: string): string;
26
- /**
27
- * A {@link TemplateSource} for a template root (a directory path or URL) laid out with a
28
- * `scaffolding.json` index at its root and template files resolved relative to it. Works for both
29
- * on-disk template directories and remote directories served over HTTP.
30
- */
31
- export declare class UriTemplateSource extends HostTemplateSource {
32
- constructor(host: SystemHost, baseUri: string);
33
- }
34
- //# sourceMappingURL=host-template-source.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"host-template-source.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/host-template-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtE,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD;;;;GAIG;AACH,8BAAsB,kBAAmB,YAAW,cAAc;IAE9D,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU;IACnC,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,qFAAqF;IACrF,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAJL,IAAI,EAAE,UAAU;IACnC,uEAAuE;IACtD,aAAa,EAAE,MAAM;IACtC,qFAAqF;IACpE,OAAO,EAAE,MAAM;IAG5B,SAAS,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAMzC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAK1D;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,kBAAkB;gBAC3C,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM;CAG9C"}
@@ -1,48 +0,0 @@
1
- import { getDirectoryPath } from "../../core/path-utils.js";
2
- import { readUrlOrPath, resolveRelativeUrlOrPath } from "../../utils/misc.js";
3
- /** File name of the template index within a template source root. */
4
- export const SCAFFOLDING_FILENAME = "scaffolding.json";
5
- /**
6
- * A {@link TemplateSource} that reads through a {@link SystemHost}, resolving files relative to a
7
- * base location (a directory path or a URL). Shared by the filesystem and remote sources, which only
8
- * differ in where their index lives.
9
- */
10
- export class HostTemplateSource {
11
- host;
12
- indexLocation;
13
- baseUri;
14
- constructor(host,
15
- /** Location of the index file (`scaffolding.json`) — a path or URL. */
16
- indexLocation,
17
- /** Base against which template file paths are resolved — a directory path or URL. */
18
- baseUri) {
19
- this.host = host;
20
- this.indexLocation = indexLocation;
21
- this.baseUri = baseUri;
22
- }
23
- async loadIndex() {
24
- const indexFile = await readUrlOrPath(this.host, this.indexLocation);
25
- const templates = JSON.parse(indexFile.text);
26
- return { templates, indexFile, baseUri: this.baseUri };
27
- }
28
- async readFile(relativePath) {
29
- // Trailing slash so URL bases resolve `rel` inside the base rather than its parent; harmless for
30
- // filesystem paths (resolvePath ignores it).
31
- return readUrlOrPath(this.host, resolveRelativeUrlOrPath(this.baseUri + "/", relativePath));
32
- }
33
- }
34
- /** Derive the base directory (path or URL) that a template index at `indexLocation` sits in. */
35
- export function baseUriOf(indexLocation) {
36
- return getDirectoryPath(indexLocation);
37
- }
38
- /**
39
- * A {@link TemplateSource} for a template root (a directory path or URL) laid out with a
40
- * `scaffolding.json` index at its root and template files resolved relative to it. Works for both
41
- * on-disk template directories and remote directories served over HTTP.
42
- */
43
- export class UriTemplateSource extends HostTemplateSource {
44
- constructor(host, baseUri) {
45
- super(host, resolveRelativeUrlOrPath(baseUri + "/", SCAFFOLDING_FILENAME), baseUri);
46
- }
47
- }
48
- //# sourceMappingURL=host-template-source.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"host-template-source.js","sourceRoot":"","sources":["../../../../src/init/template-source/host-template-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,OAAgB,kBAAkB;IAEjB;IAEF;IAEA;IALnB,YACqB,IAAgB;IACnC,uEAAuE;IACtD,aAAqB;IACtC,qFAAqF;IACpE,OAAe;QAJb,SAAI,GAAJ,IAAI,CAAY;QAElB,kBAAa,GAAb,aAAa,CAAQ;QAErB,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,KAAK,CAAC,SAAS;QACb,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,YAAoB;QACjC,iGAAiG;QACjG,6CAA6C;QAC7C,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,wBAAwB,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC;IAC9F,CAAC;CACF;AAED,gGAAgG;AAChG,MAAM,UAAU,SAAS,CAAC,aAAqB;IAC7C,OAAO,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,kBAAkB;IACvD,YAAY,IAAgB,EAAE,OAAe;QAC3C,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,OAAO,GAAG,GAAG,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;CACF"}
@@ -1,13 +0,0 @@
1
- import type { SystemHost } from "../../core/types.js";
2
- import { HostTemplateSource } from "./host-template-source.js";
3
- /**
4
- * {@link TemplateSource} for a template index hosted at a URL (`tsp init <templatesUrl>`), read
5
- * through the given {@link SystemHost}. Template files are resolved relative to the index URL.
6
- *
7
- * Loading an untrusted template can execute arbitrary code during scaffolding; callers are
8
- * responsible for confirming the source with the user before using this.
9
- */
10
- export declare class RemoteTemplateSource extends HostTemplateSource {
11
- constructor(host: SystemHost, url: string);
12
- }
13
- //# sourceMappingURL=remote-template-source.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remote-template-source.d.ts","sourceRoot":"","sources":["../../../../src/init/template-source/remote-template-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAa,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE1E;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;gBAC9C,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM;CAG1C"}
@@ -1,14 +0,0 @@
1
- import { baseUriOf, HostTemplateSource } from "./host-template-source.js";
2
- /**
3
- * {@link TemplateSource} for a template index hosted at a URL (`tsp init <templatesUrl>`), read
4
- * through the given {@link SystemHost}. Template files are resolved relative to the index URL.
5
- *
6
- * Loading an untrusted template can execute arbitrary code during scaffolding; callers are
7
- * responsible for confirming the source with the user before using this.
8
- */
9
- export class RemoteTemplateSource extends HostTemplateSource {
10
- constructor(host, url) {
11
- super(host, url, baseUriOf(url));
12
- }
13
- }
14
- //# sourceMappingURL=remote-template-source.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remote-template-source.js","sourceRoot":"","sources":["../../../../src/init/template-source/remote-template-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAC1D,YAAY,IAAgB,EAAE,GAAW;QACvC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Internal API used to build a self-contained ("standalone") TypeSpec CLI that bundles the compiler
3
- * into a single executable.
4
- *
5
- * This is a separate entrypoint from `@typespec/compiler/internals` on purpose: `runTypeSpecCli`
6
- * reaches into the CLI runner, which transitively loads `node-host` (top-level `await`) and Node
7
- * built-ins. Keeping it out of the general `internals` barrel avoids forcing those onto every
8
- * browser/CommonJS consumer of `internals` (e.g. the VS Code extension and the playground).
9
- *
10
- * DO NOT USE. Not part of the public API and may change at any time with no warning.
11
- */
12
- export { runTypeSpecCli } from "../core/cli/cli.js";
13
- export { InMemoryTemplateSource } from "../init/template-source/index.js";
14
- export type { LoadedTemplateIndex, TemplateSource } from "../init/template-source/index.js";
15
- //# sourceMappingURL=standalone.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../../src/internals/standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Internal API used to build a self-contained ("standalone") TypeSpec CLI that bundles the compiler
3
- * into a single executable.
4
- *
5
- * This is a separate entrypoint from `@typespec/compiler/internals` on purpose: `runTypeSpecCli`
6
- * reaches into the CLI runner, which transitively loads `node-host` (top-level `await`) and Node
7
- * built-ins. Keeping it out of the general `internals` barrel avoids forcing those onto every
8
- * browser/CommonJS consumer of `internals` (e.g. the VS Code extension and the playground).
9
- *
10
- * DO NOT USE. Not part of the public API and may change at any time with no warning.
11
- */
12
- export { runTypeSpecCli } from "../core/cli/cli.js";
13
- export { InMemoryTemplateSource } from "../init/template-source/index.js";
14
- //# sourceMappingURL=standalone.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standalone.js","sourceRoot":"","sources":["../../../src/internals/standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC"}