mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
- fix for attempting to write declarations for virtual modules generated by rollup-plugin-vue #97
This commit is contained in:
parent
9843cfb8e1
commit
f0e466c89f
2
dist/index.d.ts.map
vendored
2
dist/index.d.ts.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAkB,MAAM,WAAW,CAAC;AAE3E,OAAO,EAA8B,WAAW,EAAqB,MAAM,WAAW,CAAC;AAKvF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,MAAM,CAAC,OAAO,qBAAqB,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;;;;;;;;EAgU7D"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAkB,MAAM,WAAW,CAAC;AAE3E,OAAO,EAA8B,WAAW,EAAqB,MAAM,WAAW,CAAC;AAKvF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,MAAM,CAAC,OAAO,qBAAqB,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;;;;;;;;EAyU7D"}
|
||||
12
dist/rollup-plugin-typescript2.cjs.js
vendored
12
dist/rollup-plugin-typescript2.cjs.js
vendored
@ -20179,9 +20179,15 @@ function typescript(options) {
|
||||
const destDirectory = path.isAbsolute(destDirname) ? destDirname : path.join(process.cwd(), destDirname);
|
||||
writeToPath = path.join(destDirectory, path.relative(process.cwd(), e.name));
|
||||
}
|
||||
context.debug(() => `${safe_5("writing declarations")} for '${key}' to '${writeToPath}'`);
|
||||
// Write the declaration file to disk.
|
||||
tsModule.sys.writeFile(writeToPath, e.text, e.writeByteOrderMark);
|
||||
if (writeToPath.includes("?")) {
|
||||
// HACK for rollup-plugin-vue, it creates virtual modules in form 'file.vue?rollup-plugin-vue=script.d.ts'
|
||||
context.debug(() => `${safe_4("skipping declarations")} for '${key}', invalid file path`);
|
||||
}
|
||||
else {
|
||||
context.debug(() => `${safe_5("writing declarations")} for '${key}' to '${writeToPath}'`);
|
||||
// Write the declaration file to disk.
|
||||
tsModule.sys.writeFile(writeToPath, e.text, e.writeByteOrderMark);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
2
dist/rollup-plugin-typescript2.cjs.js.map
vendored
2
dist/rollup-plugin-typescript2.cjs.js.map
vendored
File diff suppressed because one or more lines are too long
12
dist/rollup-plugin-typescript2.es.js
vendored
12
dist/rollup-plugin-typescript2.es.js
vendored
@ -20175,9 +20175,15 @@ function typescript(options) {
|
||||
const destDirectory = isAbsolute(destDirname) ? destDirname : join(process.cwd(), destDirname);
|
||||
writeToPath = join(destDirectory, relative(process.cwd(), e.name));
|
||||
}
|
||||
context.debug(() => `${safe_5("writing declarations")} for '${key}' to '${writeToPath}'`);
|
||||
// Write the declaration file to disk.
|
||||
tsModule.sys.writeFile(writeToPath, e.text, e.writeByteOrderMark);
|
||||
if (writeToPath.includes("?")) {
|
||||
// HACK for rollup-plugin-vue, it creates virtual modules in form 'file.vue?rollup-plugin-vue=script.d.ts'
|
||||
context.debug(() => `${safe_4("skipping declarations")} for '${key}', invalid file path`);
|
||||
}
|
||||
else {
|
||||
context.debug(() => `${safe_5("writing declarations")} for '${key}' to '${writeToPath}'`);
|
||||
// Write the declaration file to disk.
|
||||
tsModule.sys.writeFile(writeToPath, e.text, e.writeByteOrderMark);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
2
dist/rollup-plugin-typescript2.es.js.map
vendored
2
dist/rollup-plugin-typescript2.es.js.map
vendored
File diff suppressed because one or more lines are too long
15
src/index.ts
15
src/index.ts
@ -314,6 +314,7 @@ export default function typescript(options?: Partial<IOptions>)
|
||||
{
|
||||
if (!e)
|
||||
return;
|
||||
|
||||
let writeToPath: string;
|
||||
// If for some reason no 'dest' property exists or if 'useTsconfigDeclarationDir' is given in the plugin options,
|
||||
// use the path provided by Typescript's LanguageService.
|
||||
@ -327,10 +328,18 @@ export default function typescript(options?: Partial<IOptions>)
|
||||
writeToPath = join(destDirectory, relative(process.cwd(), e.name));
|
||||
}
|
||||
|
||||
context.debug(() => `${blue("writing declarations")} for '${key}' to '${writeToPath}'`);
|
||||
if (writeToPath.includes("?"))
|
||||
{
|
||||
// HACK for rollup-plugin-vue, it creates virtual modules in form 'file.vue?rollup-plugin-vue=script.d.ts'
|
||||
context.debug(() => `${yellow("skipping declarations")} for '${key}', invalid file path`);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.debug(() => `${blue("writing declarations")} for '${key}' to '${writeToPath}'`);
|
||||
|
||||
// Write the declaration file to disk.
|
||||
tsModule.sys.writeFile(writeToPath, e.text, e.writeByteOrderMark);
|
||||
// Write the declaration file to disk.
|
||||
tsModule.sys.writeFile(writeToPath, e.text, e.writeByteOrderMark);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user