Skip to content

Commit 8443b67

Browse files
committed
Merge branch 'main' into array-from-iterable
2 parents 50a28d9 + 1d026a9 commit 8443b67

File tree

4,330 files changed

+79830
-52730
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,330 files changed

+79830
-52730
lines changed

.dprint.jsonc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
// If updating this, also update the config in dtsBundler.mjs.
23
"indentWidth": 4,
34
"lineWidth": 1000,
45
"newLineKind": "auto",
@@ -56,6 +57,7 @@
5657
"**/_namespaces/**"
5758
],
5859
// Note: if adding new languages, make sure settings.template.json is updated too.
60+
// Also, if updating typescript, update the one in package.json.
5961
"plugins": [
6062
"https://plugins.dprint.dev/typescript-0.90.5.wasm",
6163
"https://plugins.dprint.dev/json-0.19.2.wasm",

package-lock.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"!**/.gitattributes"
4040
],
4141
"devDependencies": {
42+
"@dprint/formatter": "^0.3.0",
43+
"@dprint/typescript": "0.90.5",
4244
"@esfx/canceltoken": "^1.0.0",
4345
"@octokit/rest": "^20.1.1",
4446
"@types/chai": "^4.3.16",

scripts/dtsBundler.mjs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
* bundle as namespaces again, even though the project is modules.
66
*/
77

8+
import * as dprintFormatter from "@dprint/formatter";
9+
import * as dprintTypeScript from "@dprint/typescript";
810
import assert, { fail } from "assert";
9-
import cp from "child_process";
1011
import fs from "fs";
1112
import minimist from "minimist";
1213
import path from "path";
@@ -475,23 +476,23 @@ if (publicContents.includes("@internal")) {
475476
console.error("Output includes untrimmed @internal nodes!");
476477
}
477478

478-
const dprintPath = path.resolve(__dirname, "..", "node_modules", "dprint", "bin.js");
479+
const buffer = fs.readFileSync(dprintTypeScript.getPath());
480+
const formatter = dprintFormatter.createFromBuffer(buffer);
481+
formatter.setConfig({
482+
indentWidth: 4,
483+
lineWidth: 1000,
484+
newLineKind: "auto",
485+
useTabs: false,
486+
}, {
487+
quoteStyle: "preferDouble",
488+
});
479489

480490
/**
481491
* @param {string} contents
482492
* @returns {string}
483493
*/
484494
function dprint(contents) {
485-
const result = cp.execFileSync(
486-
process.execPath,
487-
[dprintPath, "fmt", "--stdin", "ts"],
488-
{
489-
stdio: ["pipe", "pipe", "inherit"],
490-
encoding: "utf-8",
491-
input: contents,
492-
maxBuffer: 100 * 1024 * 1024, // 100 MB "ought to be enough for anyone"; https://github.com/nodejs/node/issues/9829
493-
},
494-
);
495+
const result = formatter.formatText("dummy.d.ts", contents);
495496
return result.replace(/\r\n/g, "\n");
496497
}
497498

0 commit comments

Comments
 (0)