Include JS files in XLF creation for extensions (#165774)

* Bumps @vscode/l10n-dev to a version that supports JS files
* Pulls in JS files (and TSX & JSX) in addition to TS to account for scenarios like Emmet which pulls in @vscode/emmet-helper as an npm package
This commit is contained in:
Tyler James Leonhardt
2022-11-07 19:50:39 -08:00
committed by GitHub
parent 46caa3b490
commit a8ae2cedaf
4 changed files with 26 additions and 14 deletions
+10 -4
View File
@@ -510,15 +510,21 @@ exports.createXlfFilesForCoreBundle = createXlfFilesForCoreBundle;
function createL10nBundleForExtension(extensionFolderName) {
const result = (0, event_stream_1.through)();
gulp.src([
`extensions/${extensionFolderName}/src/**/*.ts`,
// For source code of extensions
`extensions/${extensionFolderName}/src/**/*.{ts,tsx}`,
// For any dependencies pulled in (think vscode-css-languageservice or @vscode/emmet-helper)
`extensions/${extensionFolderName}/node_modules/**/*.{js,jsx}`
]).pipe((0, event_stream_1.writeArray)((err, files) => {
if (err) {
result.emit('error', err);
return;
}
const json = (0, l10n_dev_1.getL10nJson)(files.map(file => {
return file.contents.toString('utf8');
}));
const json = (0, l10n_dev_1.getL10nJson)(files
.filter(file => file.isBuffer())
.map(file => ({
contents: file.contents.toString('utf8'),
extension: path.extname(file.path)
})));
if (Object.keys(json).length > 0) {
result.emit('data', new File({
path: `extensions/${extensionFolderName}/bundle.l10n.json`,
+10 -4
View File
@@ -582,16 +582,22 @@ export function createXlfFilesForCoreBundle(): ThroughStream {
function createL10nBundleForExtension(extensionFolderName: string): ThroughStream {
const result = through();
gulp.src([
`extensions/${extensionFolderName}/src/**/*.ts`,
// For source code of extensions
`extensions/${extensionFolderName}/src/**/*.{ts,tsx}`,
// For any dependencies pulled in (think vscode-css-languageservice or @vscode/emmet-helper)
`extensions/${extensionFolderName}/node_modules/**/*.{js,jsx}`
]).pipe(writeArray((err, files: File[]) => {
if (err) {
result.emit('error', err);
return;
}
const json = getL10nJson(files.map(file => {
return file.contents.toString('utf8');
}));
const json = getL10nJson(files
.filter(file => file.isBuffer())
.map(file => ({
contents: file.contents.toString('utf8'),
extension: path.extname(file.path)
})));
if (Object.keys(json).length > 0) {
result.emit('data', new File({
+2 -2
View File
@@ -128,7 +128,7 @@
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/experimental-utils": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"@vscode/l10n-dev": "0.0.15",
"@vscode/l10n-dev": "0.0.18",
"@vscode/telemetry-extractor": "^1.9.8",
"@vscode/test-web": "^0.0.32",
"ansi-colors": "^3.2.3",
@@ -237,4 +237,4 @@
"elliptic": "^6.5.3",
"nwmatcher": "^1.4.4"
}
}
}
+4 -4
View File
@@ -1252,10 +1252,10 @@
resolved "https://registry.yarnpkg.com/@vscode/iconv-lite-umd/-/iconv-lite-umd-0.7.0.tgz#d2f1e0664ee6036408f9743fee264ea0699b0e48"
integrity sha512-bRRFxLfg5dtAyl5XyiVWz/ZBPahpOpPrNYnnHpOpUZvam4tKH35wdhP4Kj6PbM0+KdliOsPzbGWpkxcdpNB/sg==
"@vscode/l10n-dev@0.0.15":
version "0.0.15"
resolved "https://registry.yarnpkg.com/@vscode/l10n-dev/-/l10n-dev-0.0.15.tgz#677b527987ccd39e32c50956f139736a788061d6"
integrity sha512-zLuo/pa+FtnFrVq/7M8VHshgejNZ6TvnRW9/um1pLkg92PZ9glDgmwXUv1AdpBu5KNzgH9odiMKS4YQDkS12wQ==
"@vscode/l10n-dev@0.0.18":
version "0.0.18"
resolved "https://registry.yarnpkg.com/@vscode/l10n-dev/-/l10n-dev-0.0.18.tgz#80a8cf6ef13c7fe1796be7b0007d71993bd1832f"
integrity sha512-pEKLMnlg7hlxFrZLqcyJe08olmj6KVs2Rof7MVB5rN0D6NOKPBRtkQ176TuMUmW863EDV5WQUgNzOGa2nHBSSQ==
dependencies:
deepmerge-json "^1.5.0"
glob "^8.0.3"