nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions

View File

@@ -1,4 +1,38 @@
import * as acorn from 'acorn';
import inject from './inject';
/* eslint-disable no-underscore-dangle */
import { tokTypes as tt } from 'acorn';
export default inject(acorn);
export const DynamicImportKey = 'Import';
// NOTE: This allows `yield import()` to parse correctly.
tt._import.startsExpr = true;
function parseDynamicImport() {
const node = this.startNode();
this.next();
if (this.type !== tt.parenL) {
this.unexpected();
}
return this.finishNode(node, DynamicImportKey);
}
function parenAfter() {
return /^(\s|\/\/.*|\/\*[^]*?\*\/)*\(/.test(this.input.slice(this.pos));
}
export default function dynamicImport(Parser) {
return class extends Parser {
parseStatement(context, topLevel, exports) {
if (this.type === tt._import && parenAfter.call(this)) {
return this.parseExpressionStatement(this.startNode(), this.parseExpression());
}
return super.parseStatement(context, topLevel, exports);
}
parseExprAtom(refDestructuringErrors) {
if (this.type === tt._import) {
return parseDynamicImport.call(this);
}
return super.parseExprAtom(refDestructuringErrors);
}
};
}

View File

@@ -1,50 +0,0 @@
/* eslint-disable no-underscore-dangle */
export default function injectDynamicImport(acorn) {
const tt = acorn.tokTypes;
// NOTE: This allows `yield import()` to parse correctly.
tt._import.startsExpr = true;
function parseDynamicImport() {
const node = this.startNode();
this.next();
if (this.type !== tt.parenL) {
this.unexpected();
}
return this.finishNode(node, 'Import');
}
function peekNext() {
return this.input[this.pos];
}
// eslint-disable-next-line no-param-reassign
acorn.plugins.dynamicImport = function dynamicImportPlugin(instance) {
instance.extend('parseStatement', nextMethod => (
function parseStatement(...args) {
const node = this.startNode();
if (this.type === tt._import) {
const nextToken = peekNext.call(this);
if (nextToken === tt.parenL.label) {
const expr = this.parseExpression();
return this.parseExpressionStatement(node, expr);
}
}
return nextMethod.apply(this, args);
}
));
instance.extend('parseExprAtom', nextMethod => (
function parseExprAtom(refDestructuringErrors) {
if (this.type === tt._import) {
return parseDynamicImport.call(this);
}
return nextMethod.call(this, refDestructuringErrors);
}
));
};
return acorn;
}