futz the bundler idea
This commit is contained in:
parent
aaf4cbf06f
commit
e9bcccffbd
@ -1,15 +0,0 @@
|
||||
export default class Bundler {
|
||||
constructor(opts) {
|
||||
this.resolvers = [];
|
||||
this.cache = {};
|
||||
this.opts = opts;
|
||||
}
|
||||
|
||||
addResolver(resolver) {
|
||||
this.resolvers.push(resolver);
|
||||
}
|
||||
|
||||
transform() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
import { Promise } from "bluebird";
|
||||
import resolve from "resolve";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
export default function (request, parent) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
resolve(request, { basedir: path.dirname(parent) }, function (err, res) {
|
||||
if (err) {
|
||||
resolve(null);
|
||||
} else {
|
||||
fs.readFile(res, "utf8", function (err) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve({
|
||||
filename: filename,
|
||||
content: content
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
import Transformer from "./transformer";
|
||||
import normalizeAst from "../helpers/normalize-ast";
|
||||
import Bundler from "./bundler";
|
||||
import assign from "lodash/object/assign";
|
||||
import object from "../helpers/object";
|
||||
import File from "./file";
|
||||
@ -70,10 +69,6 @@ export default class TransformerPipeline {
|
||||
return file.generate();
|
||||
}
|
||||
|
||||
createBundler() {
|
||||
return new Bundler(this);
|
||||
}
|
||||
|
||||
_ensureTransformerNames(type: string, rawKeys: Array<string>) {
|
||||
var keys = [];
|
||||
|
||||
|
||||
3
test/core/fixtures/bundler/basic/simple-import/actual.js
Normal file
3
test/core/fixtures/bundler/basic/simple-import/actual.js
Normal file
@ -0,0 +1,3 @@
|
||||
import foo from "./fixtures/foo";
|
||||
|
||||
foo();
|
||||
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function fixtures$foo() {
|
||||
return "foobar";
|
||||
}
|
||||
|
||||
fixtures$foo();
|
||||
@ -0,0 +1,3 @@
|
||||
export default function () {
|
||||
return "foobar";
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user