Skip to content

Commit

Permalink
Correct filenames for non-js compiled files, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
silenceisgolden authored and jlmakes committed Jul 21, 2019
1 parent 6411b1e commit f3f19bc
Show file tree
Hide file tree
Showing 6 changed files with 1,280 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .babelrc
@@ -0,0 +1,22 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": {
"version": 3
},
"targets": "last 2 versions"
}
]
],
"plugins": [
[
"@babel/plugin-transform-typescript",
{
"allowNamespaces": true
}
]
]
}
24 changes: 22 additions & 2 deletions karma.conf.js
Expand Up @@ -22,14 +22,16 @@ module.exports = function(config) {
files: [
{ pattern: "test/t1.js", watched: false },
{ pattern: "test/t2.js", watched: false },
{ pattern: "test/t3.js", watched: false }
{ pattern: "test/t3.js", watched: false },
{ pattern: "test/t4.ts", watched: false }
],
exclude: [],

preprocessors: {
"test/t1.js": ["rollup"],
"test/t2.js": ["rollup"],
"test/t3.js": ["rollupNode"]
"test/t3.js": ["rollupNode"],
"test/t4.ts": ["rollupNodeTypescript"]
},

rollupPreprocessor: {
Expand All @@ -51,6 +53,24 @@ module.exports = function(config) {
require("rollup-plugin-buble")()
]
}
},
rollupNodeTypescript: {
base: "rollup",
options: {
plugins: [
require("rollup-plugin-node-resolve")({
extensions: [".js", ".ts"]
}),
require("rollup-plugin-commonjs")({
include: "node_modules/**",
extensions: [".js", ".ts"]
}),
require("rollup-plugin-babel")({
exclude: "node_modules/**",
extensions: [".js", ".ts"]
})
]
}
}
}
});
Expand Down
7 changes: 7 additions & 0 deletions lib/index.js
Expand Up @@ -43,6 +43,13 @@ function createPreprocessor(preconfig, config, emitter, logger) {
const { sourcemap } = options.output;

file.sourceMap = map;

/**
* for processors that have alternate source file extensions,
* make sure to use the output rollup file name
*/
const parsedPath = path.parse(file.path);
file.path = `${parsedPath.dir}/${result.fileName}`;

const processed =
sourcemap === "inline"
Expand Down

0 comments on commit f3f19bc

Please sign in to comment.