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

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 (89) hide show
  1. package/dist/manifest.js +2 -2
  2. package/dist/src/core/checker.d.ts +2 -2
  3. package/dist/src/core/checker.d.ts.map +1 -1
  4. package/dist/src/core/cli/actions/init.d.ts +0 -2
  5. package/dist/src/core/cli/actions/init.d.ts.map +1 -1
  6. package/dist/src/core/cli/actions/init.js.map +1 -1
  7. package/dist/src/core/cli/cli.d.ts +1 -15
  8. package/dist/src/core/cli/cli.d.ts.map +1 -1
  9. package/dist/src/core/cli/cli.js +12 -38
  10. package/dist/src/core/cli/cli.js.map +1 -1
  11. package/dist/src/core/cli/utils.d.ts +4 -4
  12. package/dist/src/core/cli/utils.d.ts.map +1 -1
  13. package/dist/src/core/cli/utils.js +6 -6
  14. package/dist/src/core/cli/utils.js.map +1 -1
  15. package/dist/src/core/file-ref.d.ts +26 -0
  16. package/dist/src/core/file-ref.d.ts.map +1 -0
  17. package/dist/src/core/file-ref.js +19 -0
  18. package/dist/src/core/file-ref.js.map +1 -0
  19. package/dist/src/core/name-resolver.d.ts.map +1 -1
  20. package/dist/src/core/name-resolver.js.map +1 -1
  21. package/dist/src/core/scanner.d.ts.map +1 -1
  22. package/dist/src/core/scanner.js.map +1 -1
  23. package/dist/src/core/types.d.ts +13 -0
  24. package/dist/src/core/types.d.ts.map +1 -1
  25. package/dist/src/core/types.js.map +1 -1
  26. package/dist/src/experimental/mutators.d.ts.map +1 -1
  27. package/dist/src/experimental/mutators.js.map +1 -1
  28. package/dist/src/index.d.ts +1 -0
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/index.js +1 -0
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/init/core-templates.d.ts +2 -2
  33. package/dist/src/init/core-templates.d.ts.map +1 -1
  34. package/dist/src/init/core-templates.js +2 -2
  35. package/dist/src/init/core-templates.js.map +1 -1
  36. package/dist/src/init/init.d.ts +4 -4
  37. package/dist/src/init/init.d.ts.map +1 -1
  38. package/dist/src/init/init.js +8 -10
  39. package/dist/src/init/init.js.map +1 -1
  40. package/dist/src/init/template-source/default-core-templates.d.ts +9 -0
  41. package/dist/src/init/template-source/default-core-templates.d.ts.map +1 -0
  42. package/dist/src/init/template-source/default-core-templates.js +12 -0
  43. package/dist/src/init/template-source/default-core-templates.js.map +1 -0
  44. package/dist/src/init/template-source/in-memory-template-source.d.ts +8 -10
  45. package/dist/src/init/template-source/in-memory-template-source.d.ts.map +1 -1
  46. package/dist/src/init/template-source/in-memory-template-source.js +22 -19
  47. package/dist/src/init/template-source/in-memory-template-source.js.map +1 -1
  48. package/dist/src/init/template-source/index.d.ts +2 -3
  49. package/dist/src/init/template-source/index.d.ts.map +1 -1
  50. package/dist/src/init/template-source/index.js +2 -3
  51. package/dist/src/init/template-source/index.js.map +1 -1
  52. package/dist/src/init/template-source/types.d.ts +3 -12
  53. package/dist/src/init/template-source/types.d.ts.map +1 -1
  54. package/dist/src/init/template-source/uri-template-source.d.ts +30 -0
  55. package/dist/src/init/template-source/uri-template-source.d.ts.map +1 -0
  56. package/dist/src/init/template-source/uri-template-source.js +45 -0
  57. package/dist/src/init/template-source/uri-template-source.js.map +1 -0
  58. package/dist/src/internals/index.d.ts +1 -1
  59. package/dist/src/internals/index.d.ts.map +1 -1
  60. package/dist/src/internals/index.js +1 -3
  61. package/dist/src/internals/index.js.map +1 -1
  62. package/dist/src/server/serverlib.js.map +1 -1
  63. package/dist/src/server/tmlanguage.d.ts.map +1 -1
  64. package/dist/src/server/tmlanguage.js +2 -6
  65. package/dist/src/server/tmlanguage.js.map +1 -1
  66. package/dist/src/testing/test-server-host.d.ts.map +1 -1
  67. package/dist/src/testing/test-server-host.js +9 -3
  68. package/dist/src/testing/test-server-host.js.map +1 -1
  69. package/entrypoints/cli.js +1 -3
  70. package/package.json +12 -16
  71. package/dist/src/init/template-source/file-system-template-source.d.ts +0 -12
  72. package/dist/src/init/template-source/file-system-template-source.d.ts.map +0 -1
  73. package/dist/src/init/template-source/file-system-template-source.js +0 -15
  74. package/dist/src/init/template-source/file-system-template-source.js.map +0 -1
  75. package/dist/src/init/template-source/host-template-source.d.ts +0 -34
  76. package/dist/src/init/template-source/host-template-source.d.ts.map +0 -1
  77. package/dist/src/init/template-source/host-template-source.js +0 -48
  78. package/dist/src/init/template-source/host-template-source.js.map +0 -1
  79. package/dist/src/init/template-source/remote-template-source.d.ts +0 -13
  80. package/dist/src/init/template-source/remote-template-source.d.ts.map +0 -1
  81. package/dist/src/init/template-source/remote-template-source.js +0 -14
  82. package/dist/src/init/template-source/remote-template-source.js.map +0 -1
  83. package/dist/src/internals/standalone.d.ts +0 -15
  84. package/dist/src/internals/standalone.d.ts.map +0 -1
  85. package/dist/src/internals/standalone.js +0 -14
  86. package/dist/src/internals/standalone.js.map +0 -1
  87. package/templates/__snapshots__/emitter-ts/.gitignore +0 -9
  88. package/templates/__snapshots__/library-ts/.gitignore +0 -9
  89. package/templates/__snapshots__/rest/.gitignore +0 -9
@@ -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"}
@@ -1,9 +0,0 @@
1
- # MacOS
2
- .DS_Store
3
-
4
- # Default TypeSpec output
5
- tsp-output/
6
- dist/
7
-
8
- # Dependency directories
9
- node_modules/
@@ -1,9 +0,0 @@
1
- # MacOS
2
- .DS_Store
3
-
4
- # Default TypeSpec output
5
- tsp-output/
6
- dist/
7
-
8
- # Dependency directories
9
- node_modules/
@@ -1,9 +0,0 @@
1
- # MacOS
2
- .DS_Store
3
-
4
- # Default TypeSpec output
5
- tsp-output/
6
- dist/
7
-
8
- # Dependency directories
9
- node_modules/