typescript 5.5.0-dev.20240422 → 5.5.0-dev.20240424

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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240422`;
21
+ var version = `${versionMajorMinor}.0-dev.20240424`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -11190,6 +11190,7 @@ declare namespace ts {
11190
11190
  };
11191
11191
  function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
11192
11192
  function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
11193
+ function transpileDeclaration(input: string, transpileOptions: TranspileOptions): TranspileOutput;
11193
11194
  function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
11194
11195
  interface TranspileOptions {
11195
11196
  compilerOptions?: CompilerOptions;
package/lib/typescript.js CHANGED
@@ -2272,6 +2272,7 @@ __export(typescript_exports, {
2272
2272
  transformSystemModule: () => transformSystemModule,
2273
2273
  transformTypeScript: () => transformTypeScript,
2274
2274
  transpile: () => transpile,
2275
+ transpileDeclaration: () => transpileDeclaration,
2275
2276
  transpileModule: () => transpileModule,
2276
2277
  transpileOptionValueCompilerOptions: () => transpileOptionValueCompilerOptions,
2277
2278
  tryAddToSet: () => tryAddToSet,
@@ -2360,7 +2361,7 @@ module.exports = __toCommonJS(typescript_exports);
2360
2361
 
2361
2362
  // src/compiler/corePublic.ts
2362
2363
  var versionMajorMinor = "5.5";
2363
- var version = `${versionMajorMinor}.0-dev.20240422`;
2364
+ var version = `${versionMajorMinor}.0-dev.20240424`;
2364
2365
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2365
2366
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2366
2367
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -141564,6 +141565,44 @@ var optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
141564
141565
  "isolatedModules"
141565
141566
  ]);
141566
141567
  function transpileModule(input, transpileOptions) {
141568
+ return transpileWorker(
141569
+ input,
141570
+ transpileOptions,
141571
+ /*declaration*/
141572
+ false
141573
+ );
141574
+ }
141575
+ function transpileDeclaration(input, transpileOptions) {
141576
+ return transpileWorker(
141577
+ input,
141578
+ transpileOptions,
141579
+ /*declaration*/
141580
+ true
141581
+ );
141582
+ }
141583
+ var barebonesLibContent = `/// <reference no-default-lib="true"/>
141584
+ interface Boolean {}
141585
+ interface Function {}
141586
+ interface CallableFunction {}
141587
+ interface NewableFunction {}
141588
+ interface IArguments {}
141589
+ interface Number {}
141590
+ interface Object {}
141591
+ interface RegExp {}
141592
+ interface String {}
141593
+ interface Array<T> { length: number; [n: number]: T; }
141594
+ interface SymbolConstructor {
141595
+ (desc?: string | number): symbol;
141596
+ for(name: string): symbol;
141597
+ readonly toStringTag: symbol;
141598
+ }
141599
+ declare var Symbol: SymbolConstructor;
141600
+ interface Symbol {
141601
+ readonly [Symbol.toStringTag]: string;
141602
+ }`;
141603
+ var barebonesLibName = "lib.d.ts";
141604
+ var barebonesLibSourceFile = createSourceFile(barebonesLibName, barebonesLibContent, { languageVersion: 99 /* Latest */ });
141605
+ function transpileWorker(input, transpileOptions, declaration) {
141567
141606
  const diagnostics = [];
141568
141607
  const options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
141569
141608
  const defaultOptions = getDefaultCompilerOptions2();
@@ -141580,9 +141619,16 @@ function transpileModule(input, transpileOptions) {
141580
141619
  }
141581
141620
  options.suppressOutputPathCheck = true;
141582
141621
  options.allowNonTsExtensions = true;
141622
+ if (declaration) {
141623
+ options.declaration = true;
141624
+ options.emitDeclarationOnly = true;
141625
+ options.isolatedDeclarations = true;
141626
+ } else {
141627
+ options.declaration = false;
141628
+ }
141583
141629
  const newLine = getNewLineCharacter(options);
141584
141630
  const compilerHost = {
141585
- getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : void 0,
141631
+ getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : fileName === normalizePath(barebonesLibName) ? barebonesLibSourceFile : void 0,
141586
141632
  writeFile: (name, text) => {
141587
141633
  if (fileExtensionIs(name, ".map")) {
141588
141634
  Debug.assertEqual(sourceMapText, void 0, "Unexpected multiple source map outputs, file:", name);
@@ -141592,12 +141638,12 @@ function transpileModule(input, transpileOptions) {
141592
141638
  outputText = text;
141593
141639
  }
141594
141640
  },
141595
- getDefaultLibFileName: () => "lib.d.ts",
141641
+ getDefaultLibFileName: () => barebonesLibName,
141596
141642
  useCaseSensitiveFileNames: () => false,
141597
141643
  getCanonicalFileName: (fileName) => fileName,
141598
141644
  getCurrentDirectory: () => "",
141599
141645
  getNewLine: () => newLine,
141600
- fileExists: (fileName) => fileName === inputFileName,
141646
+ fileExists: (fileName) => fileName === inputFileName || !!declaration && fileName === barebonesLibName,
141601
141647
  readFile: () => "",
141602
141648
  directoryExists: () => true,
141603
141649
  getDirectories: () => []
@@ -141627,7 +141673,8 @@ function transpileModule(input, transpileOptions) {
141627
141673
  }
141628
141674
  let outputText;
141629
141675
  let sourceMapText;
141630
- const program = createProgram([inputFileName], options, compilerHost);
141676
+ const inputs = declaration ? [inputFileName, barebonesLibName] : [inputFileName];
141677
+ const program = createProgram(inputs, options, compilerHost);
141631
141678
  if (transpileOptions.reportDiagnostics) {
141632
141679
  addRange(
141633
141680
  /*to*/
@@ -141642,7 +141689,7 @@ function transpileModule(input, transpileOptions) {
141642
141689
  program.getOptionsDiagnostics()
141643
141690
  );
141644
141691
  }
141645
- program.emit(
141692
+ const result = program.emit(
141646
141693
  /*targetSourceFile*/
141647
141694
  void 0,
141648
141695
  /*writeFile*/
@@ -141650,8 +141697,16 @@ function transpileModule(input, transpileOptions) {
141650
141697
  /*cancellationToken*/
141651
141698
  void 0,
141652
141699
  /*emitOnlyDtsFiles*/
141653
- void 0,
141654
- transpileOptions.transformers
141700
+ declaration,
141701
+ transpileOptions.transformers,
141702
+ /*forceDtsEmit*/
141703
+ declaration
141704
+ );
141705
+ addRange(
141706
+ /*to*/
141707
+ diagnostics,
141708
+ /*from*/
141709
+ result.diagnostics
141655
141710
  );
141656
141711
  if (outputText === void 0)
141657
141712
  return Debug.fail("Output generation failed");
@@ -180020,6 +180075,7 @@ __export(ts_exports2, {
180020
180075
  transformSystemModule: () => transformSystemModule,
180021
180076
  transformTypeScript: () => transformTypeScript,
180022
180077
  transpile: () => transpile,
180078
+ transpileDeclaration: () => transpileDeclaration,
180023
180079
  transpileModule: () => transpileModule,
180024
180080
  transpileOptionValueCompilerOptions: () => transpileOptionValueCompilerOptions,
180025
180081
  tryAddToSet: () => tryAddToSet,
@@ -194446,6 +194502,7 @@ if (typeof console !== "undefined") {
194446
194502
  transformSystemModule,
194447
194503
  transformTypeScript,
194448
194504
  transpile,
194505
+ transpileDeclaration,
194449
194506
  transpileModule,
194450
194507
  transpileOptionValueCompilerOptions,
194451
194508
  tryAddToSet,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-dev.20240422",
5
+ "version": "5.5.0-dev.20240424",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -110,5 +110,5 @@
110
110
  "node": "20.1.0",
111
111
  "npm": "8.19.4"
112
112
  },
113
- "gitHead": "21b5c9624c0765e6baea1f21a26531aac4824a41"
113
+ "gitHead": "0b71b81d7d053a3acd379ff49550b3c67f9ce3cd"
114
114
  }