From 91e5322226d1ad690e8c3c2f0ee802af21bf0a4c Mon Sep 17 00:00:00 2001 From: mykmartin <34528845+mykmartin@users.noreply.github.com> Date: Mon, 31 Aug 2020 16:28:19 +1000 Subject: [PATCH] Revert "Prohibit importing from other module 'internal' dirs. (#5999)" (#6050) This reverts commit 1d40e347cbcabc342d276186c37ffb8b2493afa1. --- tools/custom-loader.mjs | 8 -------- tools/sigh.ts | 2 +- tsconfig.json | 6 ++++-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tools/custom-loader.mjs b/tools/custom-loader.mjs index 6ffe5d22669..b1b35a4e076 100644 --- a/tools/custom-loader.mjs +++ b/tools/custom-loader.mjs @@ -1,5 +1,4 @@ import url from 'url'; -import path from 'path'; export function resolve(specifier, parent, resolve) { if (!/^[./]/.test(specifier)) { @@ -13,13 +12,6 @@ export function resolve(specifier, parent, resolve) { } } } - if (parent && parent.startsWith('file:///') && specifier.includes('/internal/')) { - const parentDir = path.dirname(parent.substr(7)); // 7 == len('file://') - const target = path.resolve(parentDir, specifier); - if (!target.startsWith(parentDir)) { - throw new Error(`cannot access internal file '${specifier}' from external location ${parent}`); - } - } if (!/\.(js|mjs)$/.test(specifier)) { if (/build/.test(parent)) { const resolved = new url.URL(specifier, parent || 'file:///'); diff --git a/tools/sigh.ts b/tools/sigh.ts index e7d6166e5be..09e3d5b9acf 100644 --- a/tools/sigh.ts +++ b/tools/sigh.ts @@ -391,7 +391,7 @@ function buildPath(path: string, preprocess: () => void): () => boolean { return false; } - if (!link(findProjectFiles('src', /webpack\.config\.js$/, /\.js$/))) { + if (!link(findProjectFiles('src', null, /\.js$/))) { console.error('build::link failed'); return false; } diff --git a/tsconfig.json b/tsconfig.json index 642a5edfef5..d41b46dd83f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,9 @@ "noErrorTruncation": true }, "exclude": [ - "src/tools/language-server/**/*", - "src/tools/vscode-language-client/**/*" + "build/**/*", + "cloud/**/*", + "./src/tools/language-server/**/*", + "./src/tools/vscode-language-client/**/*" ] }