Skip to content

Commit 8efa708

Browse files
committed
glint cli working ish
1 parent 24990a8 commit 8efa708

File tree

3 files changed

+7
-58
lines changed

3 files changed

+7
-58
lines changed

packages/core/bin/glint.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env node
22
// @ts-check
33
import { run } from '../lib/cli/run-volar-tsc.js';
4-
54
run();
+5-53
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,19 @@
11
import { runTsc } from '@volar/typescript/lib/quickstart/runTsc.js';
22
import { createGtsLanguagePlugin } from '../volar/gts-language-plugin.js';
33
import { loadConfig } from '../config/index.js';
4-
// import * as vue from '@vue/language-core';
54

6-
// const windowsPathReg = /\\/g;
5+
import { createRequire } from 'node:module';
6+
const require = createRequire(import.meta.url);
77

88
export function run() {
9-
109
let runExtensions = ['.js', '.ts', '.gjs', '.gts', '.hbs'];
1110
let cwd = process.cwd();
1211

13-
// const extensionsChangedException = new Error('extensions changed');
14-
const main = () => runTsc(
15-
require.resolve('typescript/lib/tsc'),
16-
runExtensions,
17-
(ts, options) => {
18-
12+
const main = () =>
13+
runTsc(require.resolve('typescript/lib/tsc'), runExtensions, (ts, options) => {
1914
const glintConfig = loadConfig(cwd);
2015
const gtsLanguagePlugin = createGtsLanguagePlugin(glintConfig);
2116
return [gtsLanguagePlugin];
22-
23-
// const { configFilePath } = options.options;
24-
// const vueOptions = typeof configFilePath === 'string'
25-
// ? vue.createParsedCommandLine(ts, ts.sys, configFilePath.replace(windowsPathReg, '/')).vueOptions
26-
// : vue.resolveVueCompilerOptions({});
27-
// const allExtensions = [
28-
// ...vueOptions.extensions,
29-
// ...vueOptions.vitePressExtensions,
30-
// ...vueOptions.petiteVueExtensions,
31-
// ];
32-
// if (
33-
// runExtensions.length === allExtensions.length
34-
// && runExtensions.every(ext => allExtensions.includes(ext))
35-
// ) {
36-
// const writeFile = options.host!.writeFile.bind(options.host);
37-
// options.host!.writeFile = (fileName, contents, ...args) => {
38-
// return writeFile(fileName, removeEmitGlobalTypes(contents), ...args);
39-
// };
40-
41-
// const glintConfig = loadConfig(cwd);
42-
// const gtsLanguagePlugin = createGtsLanguagePlugin(glintConfig);
43-
// return [gtsLanguagePlugin];
44-
// }
45-
// else {
46-
// runExtensions = allExtensions;
47-
// throw extensionsChangedException;
48-
// }
49-
}
50-
);
51-
17+
});
5218
main();
53-
// try {
54-
// } catch (err) {
55-
// if (err === extensionsChangedException) {
56-
// main();
57-
// } else {
58-
// console.error(err);
59-
// }
60-
// }
6119
}
62-
63-
// const removeEmitGlobalTypesRegexp = /^[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n?$/mg;
64-
65-
// export function removeEmitGlobalTypes(dts: string) {
66-
// return dts.replace(removeEmitGlobalTypesRegexp, '');
67-
// }

tsconfig.compileroptions.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
// Node16 allows top-level `await`, which was also unflagged in Node 14.8
55
"module": "Node16",
66
"moduleResolution": "Node16",
7-
"lib": [
8-
"WebWorker",
9-
"ES2021"
10-
],
7+
// changing this was necessary for WeakRef to be available (required/referenced in Volar)
8+
"lib": ["ESNext", "dom"],
119
"strict": true,
1210
"noImplicitOverride": true,
1311
"noPropertyAccessFromIndexSignature": true,

0 commit comments

Comments
 (0)