mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-19 23:17:16 +03:00
We don't want no node_modules
This commit is contained in:
parent
1bc1b49f84
commit
5c885e6947
@ -49,6 +49,7 @@ describe("PackageTranspilationRegistry", () => {
|
||||
let missPath = '/path/other/file3.js'
|
||||
let hitPathMissSubdir = '/path/to/file4.js'
|
||||
let hitPathMissExt = '/path/to/file5.ts'
|
||||
let nodeModulesFolder = '/path/to/lib/node_modules/file6.js'
|
||||
|
||||
let jsSpec = { glob: "lib/**/*.js", transpiler: './transpiler-js', options: { type: 'js' } }
|
||||
let coffeeSpec = { glob: "*.coffee", transpiler: './transpiler-coffee', options: { type: 'coffee' } }
|
||||
@ -95,6 +96,7 @@ describe("PackageTranspilationRegistry", () => {
|
||||
expect(wrappedCompiler.shouldCompile('source', hitPathMissExt)).toBe(false)
|
||||
expect(wrappedCompiler.shouldCompile('source', hitPathMissSubdir)).toBe(false)
|
||||
expect(wrappedCompiler.shouldCompile('source', missPath)).toBe(false)
|
||||
expect(wrappedCompiler.shouldCompile('source', nodeModulesFolder)).toBe(false)
|
||||
})
|
||||
|
||||
it('calls getCacheKeyData on the transpiler to get additional cache key data', () => {
|
||||
@ -116,6 +118,7 @@ describe("PackageTranspilationRegistry", () => {
|
||||
expect(wrappedCompiler.compile('source', missPath)).toEqual('source-original-compiler')
|
||||
expect(wrappedCompiler.compile('source', hitPathMissExt)).toEqual('source-original-compiler')
|
||||
expect(wrappedCompiler.compile('source', hitPathMissSubdir)).toEqual('source-original-compiler')
|
||||
expect(wrappedCompiler.compile('source', nodeModulesFolder)).toEqual('source-original-compiler')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -65,6 +65,11 @@ Object.assign(PackageTranspilationRegistry.prototype, {
|
||||
getPackageTranspilerSpecForFilePath: function (filePath) {
|
||||
if (this.specByFilePath[filePath] !== undefined) return this.specByFilePath[filePath]
|
||||
|
||||
// ignore node_modules
|
||||
if (filePath.indexOf(path.sep + 'node_modules' + path.sep) > -1) {
|
||||
return false
|
||||
}
|
||||
|
||||
var config = null
|
||||
var spec = null
|
||||
var thisPath = filePath
|
||||
|
Loading…
Reference in New Issue
Block a user