Skip to content

Commit

Permalink
Revert "Prohibit importing from other module 'internal' dirs. (Polyme…
Browse files Browse the repository at this point in the history
…rLabs#5999)" (PolymerLabs#6050)

This reverts commit 1d40e34.
  • Loading branch information
mykmartin authored Aug 31, 2020
1 parent 1d40e34 commit 91e5322
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
8 changes: 0 additions & 8 deletions tools/custom-loader.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import url from 'url';
import path from 'path';

export function resolve(specifier, parent, resolve) {
if (!/^[./]/.test(specifier)) {
Expand All @@ -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:///');
Expand Down
2 changes: 1 addition & 1 deletion tools/sigh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"
]
}

0 comments on commit 91e5322

Please sign in to comment.