Remove unnecessary Store subclass.
This commit is contained in:
parent
1938f490b3
commit
c8835cbbee
@ -9,7 +9,6 @@ import sourceMap from "source-map";
|
||||
import generate from "babel-generator";
|
||||
import { codeFrameColumns } from "babel-code-frame";
|
||||
import traverse from "babel-traverse";
|
||||
import Store from "../store";
|
||||
import { parse } from "babylon";
|
||||
import * as t from "babel-types";
|
||||
import buildDebug from "debug";
|
||||
@ -38,7 +37,7 @@ const errorVisitor = {
|
||||
},
|
||||
};
|
||||
|
||||
export default class File extends Store {
|
||||
export default class File {
|
||||
constructor({ options, passes }: ResolvedConfig) {
|
||||
if (!INTERNAL_PLUGINS) {
|
||||
// Lazy-init the internal plugin to remove the init-time circular dependency between plugins being
|
||||
@ -49,8 +48,7 @@ export default class File extends Store {
|
||||
}).passes[0];
|
||||
}
|
||||
|
||||
super();
|
||||
|
||||
this._map = new Map();
|
||||
this.pluginPasses = passes;
|
||||
this.opts = options;
|
||||
|
||||
@ -113,6 +111,14 @@ export default class File extends Store {
|
||||
code: string;
|
||||
shebang: string;
|
||||
|
||||
set(key: string, val) {
|
||||
this._map.set(key, val);
|
||||
}
|
||||
|
||||
get(key: string): any {
|
||||
return this._map.get(key);
|
||||
}
|
||||
|
||||
getMetadata() {
|
||||
let has = false;
|
||||
for (const node of (this.ast.program.body: Array<Object>)) {
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import Store from "./store";
|
||||
import File from "./file";
|
||||
|
||||
export default class PluginPass extends Store {
|
||||
export default class PluginPass {
|
||||
constructor(file: File, key: string, options: Object = {}) {
|
||||
super();
|
||||
this._map = new Map();
|
||||
|
||||
this.key = key;
|
||||
this.file = file;
|
||||
@ -14,6 +13,14 @@ export default class PluginPass extends Store {
|
||||
file: File;
|
||||
opts: Object;
|
||||
|
||||
set(key: string, val) {
|
||||
this._map.set(key, val);
|
||||
}
|
||||
|
||||
get(key: string): any {
|
||||
return this._map.get(key);
|
||||
}
|
||||
|
||||
addHelper(...args) {
|
||||
return this.file.addHelper(...args);
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
export default class Store {
|
||||
constructor() {
|
||||
this._map = new Map();
|
||||
}
|
||||
|
||||
set(key: string, val) {
|
||||
this._map.set(key, val);
|
||||
}
|
||||
|
||||
get(key: string): any {
|
||||
if (this._map.has(key)) {
|
||||
return this._map.get(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user