Skip to content

Commit

Permalink
textmate: fix node compatibility
Browse files Browse the repository at this point in the history
Summary:
node is dropping the `--experimental-specifier-resolution=node` support.
The new pattern requires relative imports to use `.js` suffix. Update imports
to do that. `tsc` is smart enough to look for `.ts` instead of `.js`.

Reviewed By: evangrayk

Differential Revision: D54104072

fbshipit-source-id: e0e30569dbc80b6b8ae4db17e359d068e7ff7d3d
  • Loading branch information
quark-zju authored and facebook-github-bot committed Feb 23, 2024
1 parent 9b8c2e9 commit f7d3b81
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
9 changes: 6 additions & 3 deletions addons/isl/textmate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
* This script is expected to be run from the isl/ folder.
*/

const child_process = require('child_process');
const fs = require('fs');
import * as child_process from 'node:child_process';
import * as fs from 'node:fs';
import * as url from 'url';

const __dirname = url.fileURLToPath(new URL('.', import.meta.url));

process.chdir(__dirname); // always run relative to isl/

Expand Down Expand Up @@ -51,7 +54,7 @@ rm_rf(manifestFolder);
mkdir_p(manifestFolder);
const manifestPath = `${manifestFolder}/TextMateGrammarManifest.ts`;

const node = 'node --experimental-specifier-resolution=node';
const node = 'node';
child_process.execSync(`${node} ${textmateModule}/dist/index.js ${manifestPath} ${grammarsFolder}`);

fs.copyFileSync(
Expand Down
2 changes: 1 addition & 1 deletion addons/textmate/src/LanguageExtensionOnDisk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import AbstractLanguageExtension from './AbstractLanguageExtension';
import AbstractLanguageExtension from './AbstractLanguageExtension.js';
import {promises as fs} from 'fs';
import pathMod from 'path';

Expand Down
2 changes: 1 addition & 1 deletion addons/textmate/src/LanguageExtensionOnGitHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type {ExecFileOptions} from 'child_process';

import AbstractLanguageExtension from './AbstractLanguageExtension';
import AbstractLanguageExtension from './AbstractLanguageExtension.js';
import child_process, {execFile} from 'child_process';
import {promises as fs} from 'fs';
import osMod from 'os';
Expand Down
2 changes: 1 addition & 1 deletion addons/textmate/src/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import LanguageExtensionOnGitHub from './LanguageExtensionOnGitHub';
import LanguageExtensionOnGitHub from './LanguageExtensionOnGitHub.js';

/**
* Commit within the https://github.com/Microsoft/vscode/ repo to use when
Expand Down
12 changes: 6 additions & 6 deletions addons/textmate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import type {
GrammarContribution,
GrammarSource,
NormalizedLanguageExtensionPoint,
} from './AbstractLanguageExtension';
import type AbstractLanguageExtension from './AbstractLanguageExtension';
import type {LanguageExtensionAmendment} from './languageExtensionAmendments';
} from './AbstractLanguageExtension.js';
import type AbstractLanguageExtension from './AbstractLanguageExtension.js';
import type {LanguageExtensionAmendment} from './languageExtensionAmendments.js';

import LanguageExtensionOnDisk from './LanguageExtensionOnDisk';
import builtInExtensions from './extensions';
import languageExtensionAmendments from './languageExtensionAmendments';
import LanguageExtensionOnDisk from './LanguageExtensionOnDisk.js';
import builtInExtensions from './extensions.js';
import languageExtensionAmendments from './languageExtensionAmendments.js';
import assert from 'assert';
import {promises as fs} from 'fs';
import minimist from 'minimist';
Expand Down

0 comments on commit f7d3b81

Please sign in to comment.