Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
059111e071 | |||
903fc86c9f | |||
2d5bcc8a22 | |||
32941d5949 | |||
cacb7eff6c | |||
0382c410e9 | |||
2b50191093 | |||
4967bd6a60 | |||
69ff80cc2b | |||
fef292d81f | |||
34cfe010f7 | |||
9297711793 | |||
7c0e22ff02 | |||
8041ccdada | |||
4eebed4847 | |||
7478a3739f | |||
edd407ed21 |
@ -1,5 +1,10 @@
|
||||
# gitzone standard
|
||||
image: hosttoday/ht-docker-node:npmts
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .yarn/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- test
|
||||
@ -51,10 +56,13 @@ trigger:
|
||||
- docker
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmpage
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: pages
|
||||
script:
|
||||
- npmci command yarn global add npmpage
|
||||
- npmci command npmpage --publish gitlab
|
||||
tags:
|
||||
- docker
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
|
15
README.md
15
README.md
@ -2,10 +2,10 @@
|
||||
handlebars with better fs support
|
||||
|
||||
## Availabililty
|
||||
[](https://www.npmjs.com/package/smarthbs)
|
||||
[](https://GitLab.com/pushrocks/smarthbs)
|
||||
[](https://github.com/pushrocks/smarthbs)
|
||||
[](https://pushrocks.gitlab.io/smarthbs/)
|
||||
[](https://www.npmjs.com/package/smarthbs)
|
||||
[](https://GitLab.com/pushrocks/smarthbs)
|
||||
[](https://github.com/pushrocks/smarthbs)
|
||||
[](https://pushrocks.gitlab.io/smarthbs/)
|
||||
|
||||
## Status for master
|
||||
[](https://GitLab.com/pushrocks/smarthbs/commits/master)
|
||||
@ -21,6 +21,8 @@ handlebars with better fs support
|
||||
## Usage
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
For further information read the linked docs at the top of this README.
|
||||
|
||||
> Note: Why did we decide against a class based architecture?
|
||||
Easy: handlebars.js is already pretty determined how things are handled internally, namely a global partial template registry
|
||||
It doesn't make sense to then introduce a scoped partial template approach.
|
||||
@ -35,4 +37,7 @@ smarthbs.registerPartialDir(testPartialDir)
|
||||
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json')
|
||||
```
|
||||
|
||||
[](https://push.rocks)
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[](https://push.rocks)
|
||||
|
19
dist/index.d.ts
vendored
19
dist/index.d.ts
vendored
@ -1,15 +1,8 @@
|
||||
/// <reference types="handlebars" />
|
||||
import 'typings-global';
|
||||
export declare type TTemplateStringType = 'filePath' | 'code';
|
||||
/**
|
||||
* registers a directory of partials to make them available within handlebars compilation
|
||||
*/
|
||||
export declare let registerPartialDir: (dirPathArg: string) => void;
|
||||
/**
|
||||
* compiles a directory and outputs it
|
||||
*/
|
||||
export declare let compileDirectory: (originDirPathArg: string, destinationDirPathArg: string, dataFileNameArg: string) => Promise<void>;
|
||||
/**
|
||||
* get a template for a file on disk
|
||||
*/
|
||||
export declare let getTemplateForFile: (filePathArg: string) => Promise<HandlebarsTemplateDelegate>;
|
||||
export declare let handlebars: typeof Handlebars;
|
||||
export * from './smarthbs.compile';
|
||||
import './smarthbs.helpers';
|
||||
export * from './smarthbs.partials';
|
||||
export * from './smarthbs.template';
|
||||
export * from './smarthbs.variables';
|
||||
|
63
dist/index.js
vendored
63
dist/index.js
vendored
@ -1,52 +1,13 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
require("typings-global");
|
||||
const handlebars = require("handlebars");
|
||||
const smartfile = require("smartfile");
|
||||
const path = require("path");
|
||||
/**
|
||||
* registers a directory of partials to make them available within handlebars compilation
|
||||
*/
|
||||
exports.registerPartialDir = (dirPathArg) => {
|
||||
smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
|
||||
for (let hbsFilePath of hbsFileArrayArg) {
|
||||
let parsedPath = path.parse(hbsFilePath);
|
||||
let hbsFileString = smartfile.fs.toStringSync(path.join(dirPathArg, hbsFilePath));
|
||||
if (parsedPath.dir === '') {
|
||||
parsedPath.name = '/' + parsedPath.name;
|
||||
}
|
||||
let partialName = `partials${parsedPath.dir}${parsedPath.name}`;
|
||||
handlebars.registerPartial(partialName, hbsFileString);
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* compiles a directory and outputs it
|
||||
*/
|
||||
exports.compileDirectory = (originDirPathArg, destinationDirPathArg, dataFileNameArg) => __awaiter(this, void 0, void 0, function* () {
|
||||
let hbsFilePathArray = smartfile.fs.listFilesSync(originDirPathArg, /.hbs/);
|
||||
let data = smartfile.fs.toObjectSync(path.join(originDirPathArg, dataFileNameArg));
|
||||
for (let hbsFilePath of hbsFilePathArray) {
|
||||
let parsedPath = path.parse(hbsFilePath);
|
||||
let hbsFileString = smartfile.fs.toStringSync(path.join(originDirPathArg, hbsFilePath));
|
||||
let template = handlebars.compile(hbsFileString);
|
||||
let output = template(data);
|
||||
console.log('hi ' + output + ' hi');
|
||||
smartfile.memory.toFsSync(output, path.join(destinationDirPathArg, parsedPath.name + '.html'));
|
||||
}
|
||||
});
|
||||
/**
|
||||
* get a template for a file on disk
|
||||
*/
|
||||
exports.getTemplateForFile = (filePathArg) => __awaiter(this, void 0, void 0, function* () {
|
||||
let filePathAbsolute = path.resolve(filePathArg);
|
||||
return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0FBQyxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQTtJQUNoRyxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsa0JBQWtCLEdBQUcsQ0FBTyxXQUFtQjtJQUN4RCxJQUFJLGdCQUFnQixHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDaEQsTUFBTSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFBO0FBQ3hFLENBQUMsQ0FBQSxDQUFBIn0=
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smarthbs.plugins");
|
||||
exports.handlebars = plugins.handlebars;
|
||||
__export(require("./smarthbs.compile"));
|
||||
require("./smarthbs.helpers");
|
||||
__export(require("./smarthbs.partials"));
|
||||
__export(require("./smarthbs.template"));
|
||||
__export(require("./smarthbs.variables"));
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDhDQUE2QztBQUdsQyxRQUFBLFVBQVUsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFBO0FBQzFDLHdDQUFrQztBQUNsQyw4QkFBMkI7QUFDM0IseUNBQW1DO0FBQ25DLHlDQUFtQztBQUNuQywwQ0FBb0MifQ==
|
4
dist/smarthbs.compile.d.ts
vendored
Normal file
4
dist/smarthbs.compile.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* compiles a directory and outputs it
|
||||
*/
|
||||
export declare let compileDirectory: (originDirPathArg: string, destinationDirPathArg: string, dataFileNameArg: string) => Promise<void>;
|
27
dist/smarthbs.compile.js
vendored
Normal file
27
dist/smarthbs.compile.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smarthbs.plugins");
|
||||
/**
|
||||
* compiles a directory and outputs it
|
||||
*/
|
||||
exports.compileDirectory = (originDirPathArg, destinationDirPathArg, dataFileNameArg) => __awaiter(this, void 0, void 0, function* () {
|
||||
let hbsFilePathArray = plugins.smartfile.fs.listFilesSync(originDirPathArg, /.hbs/);
|
||||
let data = plugins.smartfile.fs.toObjectSync(plugins.path.join(originDirPathArg, dataFileNameArg));
|
||||
for (let hbsFilePath of hbsFilePathArray) {
|
||||
let parsedPath = plugins.path.parse(hbsFilePath);
|
||||
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(originDirPathArg, hbsFilePath));
|
||||
let template = plugins.handlebars.compile(hbsFileString);
|
||||
let output = template(data);
|
||||
console.log('hi ' + output + ' hi');
|
||||
plugins.smartfile.memory.toFsSync(output, plugins.path.join(destinationDirPathArg, parsedPath.name + '.html'));
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuY29tcGlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbI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BQTtRQUNuQyxPQUFPLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLHFCQUFxQixFQUFFLFVBQVUsQ0FBQyxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQTtJQUNoSCxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUEifQ==
|
0
dist/smarthbs.helpers.d.ts
vendored
Normal file
0
dist/smarthbs.helpers.d.ts
vendored
Normal file
8
dist/smarthbs.helpers.js
vendored
Normal file
8
dist/smarthbs.helpers.js
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smarthbs.plugins");
|
||||
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
|
||||
let template = plugins.handlebars.compile(evaluationString);
|
||||
return template(evaluationContext);
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw4Q0FBNkM7QUFFN0MsT0FBTyxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsV0FBVyxFQUFFLENBQUMsZ0JBQWdCLEVBQUUsaUJBQWlCO0lBQ2pGLElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBQUE7SUFDM0QsTUFBTSxDQUFDLFFBQVEsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFBO0FBQ3BDLENBQUMsQ0FBQyxDQUFBIn0=
|
4
dist/smarthbs.partials.d.ts
vendored
Normal file
4
dist/smarthbs.partials.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* registers a directory of partials to make them available within handlebars compilation
|
||||
*/
|
||||
export declare let registerPartialDir: (dirPathArg: string) => Promise<any>;
|
23
dist/smarthbs.partials.js
vendored
Normal file
23
dist/smarthbs.partials.js
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smarthbs.plugins");
|
||||
/**
|
||||
* registers a directory of partials to make them available within handlebars compilation
|
||||
*/
|
||||
exports.registerPartialDir = (dirPathArg) => {
|
||||
let done = plugins.smartq.defer();
|
||||
plugins.smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
|
||||
for (let hbsFilePath of hbsFileArrayArg) {
|
||||
let parsedPath = plugins.path.parse(hbsFilePath);
|
||||
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, hbsFilePath));
|
||||
if (parsedPath.dir === '') {
|
||||
parsedPath.name = '/' + parsedPath.name;
|
||||
}
|
||||
let partialName = `partials${parsedPath.dir}${parsedPath.name}`;
|
||||
plugins.handlebars.registerPartial(partialName, hbsFileString);
|
||||
done.resolve();
|
||||
}
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMucGFydGlhbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy5wYXJ0aWFscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDhDQUE2QztBQUU3Qzs7R0FFRztBQUNRLFFBQUEsa0JBQWtCLEdBQUcsQ0FBQyxVQUFrQjtJQUNqRCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxDQUFBO0lBQ2pDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxVQUFVLEVBQUUsVUFBVSxDQUFDLENBQUMsSUFBSSxDQUFDLGVBQWU7UUFDNUUsR0FBRyxDQUFDLENBQUMsSUFBSSxXQUFXLElBQUksZUFBZSxDQUFDLENBQUMsQ0FBQztZQUN4QyxJQUFJLFVBQVUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQTtZQUNoRCxJQUFJLGFBQWEsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxFQUFFLFdBQVcsQ0FBQyxDQUFDLENBQUE7WUFDakcsRUFBRSxDQUFDLENBQUMsVUFBVSxDQUFDLEdBQUcsS0FBSyxFQUFFLENBQUMsQ0FBQyxDQUFDO2dCQUMxQixVQUFVLENBQUMsSUFBSSxHQUFHLEdBQUcsR0FBRyxVQUFVLENBQUMsSUFBSSxDQUFBO1lBQ3pDLENBQUM7WUFDRCxJQUFJLFdBQVcsR0FBRyxXQUFXLFVBQVUsQ0FBQyxHQUFHLEdBQUcsVUFBVSxDQUFDLElBQUksRUFBRSxDQUFBO1lBQy9ELE9BQU8sQ0FBQyxVQUFVLENBQUMsZUFBZSxDQUFDLFdBQVcsRUFBRSxhQUFhLENBQUMsQ0FBQTtZQUM5RCxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUE7UUFDaEIsQ0FBQztJQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDckIsQ0FBQyxDQUFBIn0=
|
7
dist/smarthbs.plugins.d.ts
vendored
Normal file
7
dist/smarthbs.plugins.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import 'typings-global';
|
||||
import * as handlebars from 'handlebars';
|
||||
import * as lodash from 'lodash';
|
||||
import * as path from 'path';
|
||||
import * as smartfile from 'smartfile';
|
||||
import * as smartq from 'smartq';
|
||||
export { handlebars, lodash, path, smartfile, smartq };
|
14
dist/smarthbs.plugins.js
vendored
Normal file
14
dist/smarthbs.plugins.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("typings-global");
|
||||
const handlebars = require("handlebars");
|
||||
exports.handlebars = handlebars;
|
||||
const lodash = require("lodash");
|
||||
exports.lodash = lodash;
|
||||
const path = require("path");
|
||||
exports.path = path;
|
||||
const smartfile = require("smartfile");
|
||||
exports.smartfile = smartfile;
|
||||
const smartq = require("smartq");
|
||||
exports.smartq = smartq;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFDdkIseUNBQXdDO0FBT3RDLGdDQUFVO0FBTlosaUNBQWdDO0FBTzlCLHdCQUFNO0FBTlIsNkJBQTRCO0FBTzFCLG9CQUFJO0FBTk4sdUNBQXNDO0FBT3BDLDhCQUFTO0FBTlgsaUNBQWdDO0FBTzlCLHdCQUFNIn0=
|
5
dist/smarthbs.template.d.ts
vendored
Normal file
5
dist/smarthbs.template.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/// <reference types="handlebars" />
|
||||
/**
|
||||
* get a template for a file on disk
|
||||
*/
|
||||
export declare let getTemplateForFile: (filePathArg: string) => Promise<HandlebarsTemplateDelegate>;
|
19
dist/smarthbs.template.js
vendored
Normal file
19
dist/smarthbs.template.js
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smarthbs.plugins");
|
||||
/**
|
||||
* get a template for a file on disk
|
||||
*/
|
||||
exports.getTemplateForFile = (filePathArg) => __awaiter(this, void 0, void 0, function* () {
|
||||
let filePathAbsolute = plugins.path.resolve(filePathArg);
|
||||
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute));
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy50ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsOENBQTZDO0FBRTdDOztHQUVHO0FBQ1EsUUFBQSxrQkFBa0IsR0FBRyxDQUFPLFdBQW1CO0lBQ3hELElBQUksZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDeEQsTUFBTSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUE7QUFDeEYsQ0FBQyxDQUFBLENBQUEifQ==
|
12
dist/smarthbs.variables.d.ts
vendored
Normal file
12
dist/smarthbs.variables.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* finds all variables in a handlebars template
|
||||
* @param hbsStringArg
|
||||
*/
|
||||
export declare let findVarsInHbsString: (hbsStringArg: string) => Promise<string[]>;
|
||||
/**
|
||||
* checks if supplied variables satisfy an handlebars template
|
||||
* @param hbsStringArg
|
||||
* @param varObjectArg
|
||||
* @return string array with missing variable names
|
||||
*/
|
||||
export declare let checkVarsSatisfaction: (hbsStringArg: string, varObjectArg: any) => Promise<string[]>;
|
70
dist/smarthbs.variables.js
vendored
Normal file
70
dist/smarthbs.variables.js
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
// This file contains code that makes it easy to search handlebar templates for variables.
|
||||
// Why? To get a clue if you are missing some.
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smarthbs.plugins");
|
||||
// the curly regex objects
|
||||
let tripleCurlyRegex = /{{{\s*[\w\.]+\s*}}}/g;
|
||||
let doubleCurlyRegex = /{{\s*[\w\.]+\s*}}/g;
|
||||
let nameInCurlsRegex = /[\w\.]+/;
|
||||
/**
|
||||
* finds all variables in a handlebars template
|
||||
* @param hbsStringArg
|
||||
*/
|
||||
exports.findVarsInHbsString = (hbsStringArg) => __awaiter(this, void 0, void 0, function* () {
|
||||
let hbsString = hbsStringArg; // make sure we have a new string object that we may destroy
|
||||
let varNameArray = [];
|
||||
let tripleCurlyMatches = hbsString.match(tripleCurlyRegex);
|
||||
if (tripleCurlyMatches) {
|
||||
hbsString = hbsString.replace(tripleCurlyRegex, '[[[replaced]]]');
|
||||
}
|
||||
let doubleCurlyMatches = hbsString.match(doubleCurlyRegex);
|
||||
varNameArray = plugins.lodash.concat(varNameArray, tripleCurlyMatches, doubleCurlyMatches)
|
||||
.map((x) => {
|
||||
return x.match(nameInCurlsRegex)[0];
|
||||
});
|
||||
varNameArray = plugins.lodash.uniq(varNameArray);
|
||||
return varNameArray;
|
||||
});
|
||||
/**
|
||||
* checks if supplied variables satisfy an handlebars template
|
||||
* @param hbsStringArg
|
||||
* @param varObjectArg
|
||||
* @return string array with missing variable names
|
||||
*/
|
||||
exports.checkVarsSatisfaction = (hbsStringArg, varObjectArg) => __awaiter(this, void 0, void 0, function* () {
|
||||
// required vars as combined deep string with . notation
|
||||
let requiredVarStrings = yield exports.findVarsInHbsString(hbsStringArg);
|
||||
// comparison objects
|
||||
let suppliedVarsObject = varObjectArg;
|
||||
let missingVarsObject = [];
|
||||
// building the
|
||||
for (let stringVar of requiredVarStrings) {
|
||||
let splittedVars = stringVar.split('.');
|
||||
let requiredPointer = suppliedVarsObject;
|
||||
for (let i = 0; i < splittedVars.length; i++) {
|
||||
let splitVar = splittedVars[i];
|
||||
let varAvailable = (requiredPointer[splitVar] !== undefined);
|
||||
if (varAvailable && splittedVars.length === (i + 1)) {
|
||||
// ok
|
||||
}
|
||||
else if (varAvailable) {
|
||||
requiredPointer = requiredPointer[splitVar];
|
||||
}
|
||||
else {
|
||||
missingVarsObject.push(stringVar);
|
||||
i = splittedVars.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
return missingVarsObject;
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudmFyaWFibGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRoYnMudmFyaWFibGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwRkFBME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UFDO2dCQUN4QixlQUFlLEdBQUcsZUFBZSxDQUFFLFFBQVEsQ0FBRSxDQUFBO1lBQy9DLENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixpQkFBaUIsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7Z0JBQ2pDLENBQUMsR0FBRyxZQUFZLENBQUMsTUFBTSxDQUFBO1lBQ3pCLENBQUM7UUFDSCxDQUFDO0lBQ0gsQ0FBQztJQUNELE1BQU0sQ0FBQyxpQkFBaUIsQ0FBQTtBQUMxQixDQUFDLENBQUEsQ0FBQSJ9
|
7
npmextra.json
Normal file
7
npmextra.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"npmci": {
|
||||
"globalNpmTools": [
|
||||
"npmts"
|
||||
]
|
||||
}
|
||||
}
|
16
package.json
16
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "smarthbs",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.11",
|
||||
"description": "handlebars with better fs support",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
@ -21,13 +21,15 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pkunz/smarthbs#README",
|
||||
"dependencies": {
|
||||
"@types/handlebars": "^4.0.31",
|
||||
"handlebars": "^4.0.6",
|
||||
"smartfile": "^4.1.4",
|
||||
"smartq": "^1.0.4",
|
||||
"typings-global": "^1.0.14"
|
||||
"@types/handlebars": "^4.0.32",
|
||||
"@types/lodash": "^4.14.63",
|
||||
"handlebars": "^4.0.7",
|
||||
"lodash": "^4.17.4",
|
||||
"smartfile": "^4.2.9",
|
||||
"smartq": "^1.1.1",
|
||||
"typings-global": "^1.0.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typings-test": "^1.0.3"
|
||||
"tapbundle": "^1.0.10"
|
||||
}
|
||||
}
|
||||
|
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +0,0 @@
|
||||
import 'typings-test';
|
16
test/test.js
16
test/test.js
@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-test");
|
||||
const smarthbs = require("../dist/index");
|
||||
const path = require("path");
|
||||
let testHbsDir = path.join(__dirname, 'hbs_testfiles');
|
||||
let testPartialDir = path.join(testHbsDir, 'partials');
|
||||
let testResultDir = path.join(__dirname, 'testresult');
|
||||
describe('smarthbs', function () {
|
||||
it('should create partials', function () {
|
||||
smarthbs.registerPartialDir(testPartialDir);
|
||||
});
|
||||
it('should compile a directory', function () {
|
||||
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json');
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQiwwQ0FBeUM7QUFDekMsNkJBQTRCO0FBRTVCLElBQUksVUFBVSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLGVBQWUsQ0FBQyxDQUFBO0FBQ3RELElBQUksY0FBYyxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxFQUFFLFVBQVUsQ0FBQyxDQUFBO0FBQ3RELElBQUksYUFBYSxHQUFHLElBQUksQ0FBRSxJQUFJLENBQUMsU0FBUyxFQUFFLFlBQVksQ0FBQyxDQUFBO0FBQ3ZELFFBQVEsQ0FBQyxVQUFVLEVBQUU7SUFFakIsRUFBRSxDQUFDLHdCQUF3QixFQUFFO1FBQ3pCLFFBQVEsQ0FBQyxrQkFBa0IsQ0FBQyxjQUFjLENBQUMsQ0FBQTtJQUMvQyxDQUFDLENBQUMsQ0FBQTtJQUVGLEVBQUUsQ0FBQyw0QkFBNEIsRUFBRTtRQUM3QixRQUFRLENBQUMsZ0JBQWdCLENBQUMsVUFBVSxFQUFFLGFBQWEsRUFBRSxXQUFXLENBQUMsQ0FBQTtJQUNyRSxDQUFDLENBQUMsQ0FBQTtBQUVOLENBQUMsQ0FBQyxDQUFBIn0=
|
42
test/test.ts
42
test/test.ts
@ -1,18 +1,38 @@
|
||||
import 'typings-test'
|
||||
import { expect, tap } from 'tapbundle'
|
||||
import * as smarthbs from '../dist/index'
|
||||
import * as path from 'path'
|
||||
|
||||
let testHbsDir = path.join(__dirname, 'hbs_testfiles')
|
||||
let testPartialDir = path.join(testHbsDir, 'partials')
|
||||
let testResultDir = path .join(__dirname, 'testresult')
|
||||
describe('smarthbs', function() {
|
||||
|
||||
it('should create partials', function(){
|
||||
smarthbs.registerPartialDir(testPartialDir)
|
||||
})
|
||||
let testResultDir = path.join(__dirname, 'testresult')
|
||||
tap.test('smarthbs -> should create partials', async () => {
|
||||
await smarthbs.registerPartialDir(testPartialDir)
|
||||
})
|
||||
|
||||
it('should compile a directory', function() {
|
||||
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json')
|
||||
})
|
||||
tap.test('smarthbs -> should compile a directory', async () => {
|
||||
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json')
|
||||
})
|
||||
|
||||
})
|
||||
tap.test('', async () => {
|
||||
let templateString = '{{{firstVar}}} {{secondVar}}'
|
||||
let templateVars = await smarthbs.findVarsInHbsString(templateString)
|
||||
expect(templateVars).to.include('firstVar')
|
||||
expect(templateVars).to.include('secondVar')
|
||||
})
|
||||
|
||||
tap.test('', async () => {
|
||||
let templateString = '{{{firstVar}}} {{secondVar}} {{thirdVar}} {{fourthVar}} {{fourthVar.someKey}} {{fourthVar.otherKey.nextKey}}'
|
||||
let missingVars = await smarthbs.checkVarsSatisfaction(templateString, {
|
||||
firstVar: 'hi',
|
||||
secondVar: 'hello',
|
||||
fourthVar: {
|
||||
otherKey: {
|
||||
nextKey: 'wow'
|
||||
}
|
||||
}
|
||||
})
|
||||
expect(missingVars).to.contain('thirdVar', 'fourthVar.someKey')
|
||||
expect(missingVars).to.not.contain('secondVar', 'fourthVar.otherKey.nextKey')
|
||||
})
|
||||
|
||||
tap.start()
|
||||
|
55
ts/index.ts
55
ts/index.ts
@ -1,50 +1,9 @@
|
||||
import 'typings-global'
|
||||
import * as handlebars from 'handlebars'
|
||||
import * as smartfile from 'smartfile'
|
||||
import * as path from 'path'
|
||||
import * as plugins from './smarthbs.plugins'
|
||||
export type TTemplateStringType = 'filePath' | 'code'
|
||||
|
||||
/**
|
||||
* registers a directory of partials to make them available within handlebars compilation
|
||||
*/
|
||||
export let registerPartialDir = (dirPathArg: string) => {
|
||||
smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
|
||||
for (let hbsFilePath of hbsFileArrayArg) {
|
||||
let parsedPath = path.parse(hbsFilePath)
|
||||
let hbsFileString = smartfile.fs.toStringSync(path.join(dirPathArg, hbsFilePath))
|
||||
if (parsedPath.dir === '') {
|
||||
parsedPath.name = '/' + parsedPath.name
|
||||
}
|
||||
let partialName = `partials${parsedPath.dir}${parsedPath.name}`
|
||||
handlebars.registerPartial(partialName, hbsFileString)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* compiles a directory and outputs it
|
||||
*/
|
||||
export let compileDirectory = async (
|
||||
originDirPathArg: string,
|
||||
destinationDirPathArg: string,
|
||||
dataFileNameArg: string
|
||||
) => {
|
||||
let hbsFilePathArray = smartfile.fs.listFilesSync(originDirPathArg, /.hbs/)
|
||||
let data = smartfile.fs.toObjectSync(path.join(originDirPathArg, dataFileNameArg))
|
||||
for (let hbsFilePath of hbsFilePathArray) {
|
||||
let parsedPath = path.parse(hbsFilePath)
|
||||
let hbsFileString = smartfile.fs.toStringSync(path.join(originDirPathArg, hbsFilePath))
|
||||
let template = handlebars.compile(hbsFileString)
|
||||
let output = template(data)
|
||||
console.log('hi ' + output + ' hi')
|
||||
smartfile.memory.toFsSync(output, path.join(destinationDirPathArg, parsedPath.name + '.html'))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get a template for a file on disk
|
||||
*/
|
||||
export let getTemplateForFile = async (filePathArg: string) => {
|
||||
let filePathAbsolute = path.resolve(filePathArg)
|
||||
return handlebars.compile(smartfile.fs.toStringSync(filePathAbsolute))
|
||||
}
|
||||
export let handlebars = plugins.handlebars
|
||||
export * from './smarthbs.compile'
|
||||
import './smarthbs.helpers'
|
||||
export * from './smarthbs.partials'
|
||||
export * from './smarthbs.template'
|
||||
export * from './smarthbs.variables'
|
||||
|
21
ts/smarthbs.compile.ts
Normal file
21
ts/smarthbs.compile.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import * as plugins from './smarthbs.plugins'
|
||||
|
||||
/**
|
||||
* compiles a directory and outputs it
|
||||
*/
|
||||
export let compileDirectory = async (
|
||||
originDirPathArg: string,
|
||||
destinationDirPathArg: string,
|
||||
dataFileNameArg: string
|
||||
) => {
|
||||
let hbsFilePathArray = plugins.smartfile.fs.listFilesSync(originDirPathArg, /.hbs/)
|
||||
let data = plugins.smartfile.fs.toObjectSync(plugins.path.join(originDirPathArg, dataFileNameArg))
|
||||
for (let hbsFilePath of hbsFilePathArray) {
|
||||
let parsedPath = plugins.path.parse(hbsFilePath)
|
||||
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(originDirPathArg, hbsFilePath))
|
||||
let template = plugins.handlebars.compile(hbsFileString)
|
||||
let output = template(data)
|
||||
console.log('hi ' + output + ' hi')
|
||||
plugins.smartfile.memory.toFsSync(output, plugins.path.join(destinationDirPathArg, parsedPath.name + '.html'))
|
||||
}
|
||||
}
|
8
ts/smarthbs.helpers.ts
Normal file
8
ts/smarthbs.helpers.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import * as plugins from './smarthbs.plugins'
|
||||
|
||||
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
|
||||
let template = plugins.handlebars.compile(evaluationString)
|
||||
return template(evaluationContext)
|
||||
})
|
||||
|
||||
|
21
ts/smarthbs.partials.ts
Normal file
21
ts/smarthbs.partials.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import * as plugins from './smarthbs.plugins'
|
||||
|
||||
/**
|
||||
* registers a directory of partials to make them available within handlebars compilation
|
||||
*/
|
||||
export let registerPartialDir = (dirPathArg: string): Promise<any> => {
|
||||
let done = plugins.smartq.defer()
|
||||
plugins.smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
|
||||
for (let hbsFilePath of hbsFileArrayArg) {
|
||||
let parsedPath = plugins.path.parse(hbsFilePath)
|
||||
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, hbsFilePath))
|
||||
if (parsedPath.dir === '') {
|
||||
parsedPath.name = '/' + parsedPath.name
|
||||
}
|
||||
let partialName = `partials${parsedPath.dir}${parsedPath.name}`
|
||||
plugins.handlebars.registerPartial(partialName, hbsFileString)
|
||||
done.resolve()
|
||||
}
|
||||
})
|
||||
return done.promise
|
||||
}
|
14
ts/smarthbs.plugins.ts
Normal file
14
ts/smarthbs.plugins.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import 'typings-global'
|
||||
import * as handlebars from 'handlebars'
|
||||
import * as lodash from 'lodash'
|
||||
import * as path from 'path'
|
||||
import * as smartfile from 'smartfile'
|
||||
import * as smartq from 'smartq'
|
||||
|
||||
export {
|
||||
handlebars,
|
||||
lodash,
|
||||
path,
|
||||
smartfile,
|
||||
smartq
|
||||
}
|
9
ts/smarthbs.template.ts
Normal file
9
ts/smarthbs.template.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import * as plugins from './smarthbs.plugins'
|
||||
|
||||
/**
|
||||
* get a template for a file on disk
|
||||
*/
|
||||
export let getTemplateForFile = async (filePathArg: string) => {
|
||||
let filePathAbsolute = plugins.path.resolve(filePathArg)
|
||||
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute))
|
||||
}
|
63
ts/smarthbs.variables.ts
Normal file
63
ts/smarthbs.variables.ts
Normal file
@ -0,0 +1,63 @@
|
||||
// This file contains code that makes it easy to search handlebar templates for variables.
|
||||
// Why? To get a clue if you are missing some.
|
||||
|
||||
import * as plugins from './smarthbs.plugins'
|
||||
|
||||
// the curly regex objects
|
||||
let tripleCurlyRegex = /{{{\s*[\w\.]+\s*}}}/g
|
||||
let doubleCurlyRegex = /{{\s*[\w\.]+\s*}}/g
|
||||
let nameInCurlsRegex = /[\w\.]+/
|
||||
|
||||
/**
|
||||
* finds all variables in a handlebars template
|
||||
* @param hbsStringArg
|
||||
*/
|
||||
export let findVarsInHbsString = async (hbsStringArg: string) => {
|
||||
let hbsString = hbsStringArg // make sure we have a new string object that we may destroy
|
||||
let varNameArray: string[] = []
|
||||
let tripleCurlyMatches = hbsString.match(tripleCurlyRegex)
|
||||
if (tripleCurlyMatches) {
|
||||
hbsString = hbsString.replace(tripleCurlyRegex, '[[[replaced]]]')
|
||||
}
|
||||
let doubleCurlyMatches = hbsString.match(doubleCurlyRegex)
|
||||
varNameArray = plugins.lodash.concat(varNameArray, tripleCurlyMatches, doubleCurlyMatches)
|
||||
.map((x) => {
|
||||
return x.match(nameInCurlsRegex)[ 0 ]
|
||||
})
|
||||
varNameArray = plugins.lodash.uniq(varNameArray)
|
||||
return varNameArray
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if supplied variables satisfy an handlebars template
|
||||
* @param hbsStringArg
|
||||
* @param varObjectArg
|
||||
* @return string array with missing variable names
|
||||
*/
|
||||
export let checkVarsSatisfaction = async (hbsStringArg: string, varObjectArg: any) => {
|
||||
// required vars as combined deep string with . notation
|
||||
let requiredVarStrings = await findVarsInHbsString(hbsStringArg)
|
||||
|
||||
// comparison objects
|
||||
let suppliedVarsObject = varObjectArg
|
||||
let missingVarsObject: string[] = []
|
||||
|
||||
// building the
|
||||
for (let stringVar of requiredVarStrings) {
|
||||
let splittedVars = stringVar.split('.')
|
||||
let requiredPointer = suppliedVarsObject
|
||||
for (let i = 0; i < splittedVars.length; i++) {
|
||||
let splitVar = splittedVars[ i ]
|
||||
let varAvailable = (requiredPointer[ splitVar ] !== undefined)
|
||||
if (varAvailable && splittedVars.length === (i + 1)) {
|
||||
// ok
|
||||
} else if (varAvailable) {
|
||||
requiredPointer = requiredPointer[ splitVar ]
|
||||
} else {
|
||||
missingVarsObject.push(stringVar)
|
||||
i = splittedVars.length
|
||||
}
|
||||
}
|
||||
}
|
||||
return missingVarsObject
|
||||
}
|
312
yarn.lock
312
yarn.lock
@ -2,23 +2,44 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/fs-extra@0.x.x":
|
||||
version "0.0.37"
|
||||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-0.0.37.tgz#195f11bcd9a1b97d9e412c6b66899b545471a1f7"
|
||||
"@types/chai-as-promised@0.0.29":
|
||||
version "0.0.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
|
||||
dependencies:
|
||||
"@types/chai" "*"
|
||||
"@types/promises-a-plus" "*"
|
||||
|
||||
"@types/chai-string@^1.1.30":
|
||||
version "1.1.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
|
||||
dependencies:
|
||||
"@types/chai" "*"
|
||||
|
||||
"@types/chai@*", "@types/chai@^3.4.35":
|
||||
version "3.5.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
|
||||
|
||||
"@types/fs-extra@2.x.x":
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-2.1.0.tgz#8b350239c0455d92b8d3c626edac193860ff395f"
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/handlebars@^4.0.31":
|
||||
version "4.0.31"
|
||||
resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.31.tgz#a7fba66fafe42713aee88eeca8db91192efe6e72"
|
||||
"@types/handlebars@^4.0.32":
|
||||
version "4.0.32"
|
||||
resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.32.tgz#637e8d945a9354aab47df7125005490fe9f8e592"
|
||||
|
||||
"@types/mocha@^2.2.31":
|
||||
version "2.2.39"
|
||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.39.tgz#f68d63db8b69c38e9558b4073525cf96c4f7a829"
|
||||
"@types/lodash@^4.14.63":
|
||||
version "4.14.63"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.63.tgz#5ac475f55bfdc62bc88c4239dbc482f2f3bead93"
|
||||
|
||||
"@types/node@*":
|
||||
version "7.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.5.tgz#96a0f0a618b7b606f1ec547403c00650210bfbb7"
|
||||
version "7.0.15"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.15.tgz#628429289604c5f7e56c13f3a0422f3e59df1a17"
|
||||
|
||||
"@types/promises-a-plus@*":
|
||||
version "0.0.27"
|
||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
||||
|
||||
"@types/vinyl@^2.0.0":
|
||||
version "2.0.0"
|
||||
@ -38,32 +59,47 @@ amdefine@>=0.0.4:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
||||
|
||||
ansi-256-colors@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
||||
|
||||
argparse@^1.0.7:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86"
|
||||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
assertion-error@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
||||
|
||||
async@^1.4.0:
|
||||
version "1.5.2"
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
|
||||
|
||||
async@~0.2.6:
|
||||
version "0.2.10"
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
|
||||
|
||||
balanced-match@^0.4.1:
|
||||
version "0.4.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
||||
|
||||
beautycolor@^1.0.7:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
|
||||
dependencies:
|
||||
ansi-256-colors "^1.1.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
bindings@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
|
||||
|
||||
brace-expansion@^1.0.0:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
|
||||
version "1.1.7"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59"
|
||||
dependencies:
|
||||
balanced-match "^0.4.1"
|
||||
concat-map "0.0.1"
|
||||
|
||||
buffer-shims@^1.0.0:
|
||||
buffer-shims@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51"
|
||||
|
||||
@ -78,6 +114,28 @@ center-align@^0.1.1:
|
||||
align-text "^0.1.3"
|
||||
lazy-cache "^1.0.3"
|
||||
|
||||
chai-as-promised@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
|
||||
dependencies:
|
||||
check-error "^1.0.2"
|
||||
|
||||
chai-string@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.3.0.tgz#df6139f294391b1035be5606f60a843b3a5041e7"
|
||||
|
||||
chai@^3.5.0:
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
|
||||
dependencies:
|
||||
assertion-error "^1.0.1"
|
||||
deep-eql "^0.1.3"
|
||||
type-detect "^1.0.0"
|
||||
|
||||
check-error@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
||||
|
||||
cliui@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
|
||||
@ -118,6 +176,20 @@ decamelize@^1.0.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
|
||||
deep-eql@^0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
||||
dependencies:
|
||||
type-detect "0.1.1"
|
||||
|
||||
early@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
|
||||
dependencies:
|
||||
beautycolor "^1.0.7"
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
esprima@^3.1.1:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
|
||||
@ -128,12 +200,13 @@ first-chunk-stream@^2.0.0:
|
||||
dependencies:
|
||||
readable-stream "^2.0.2"
|
||||
|
||||
fs-extra@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.0.0.tgz#337352bded4a0b714f3eb84de8cea765e9d37600"
|
||||
fs-extra@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.0.tgz#244e0c4b0b8818f54040ec049d8a2bddc1202861"
|
||||
dependencies:
|
||||
graceful-fs "^4.1.2"
|
||||
jsonfile "^2.1.0"
|
||||
jsonfile "^3.0.0"
|
||||
universalify "^0.1.0"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
@ -154,9 +227,9 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6:
|
||||
version "4.1.11"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
|
||||
|
||||
handlebars@^4.0.6:
|
||||
version "4.0.6"
|
||||
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.6.tgz#2ce4484850537f9c97a8026d5399b935c4ed4ed7"
|
||||
handlebars@^4.0.7:
|
||||
version "4.0.7"
|
||||
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.7.tgz#e97325aeb8ea0b9e12b9c4dd73c4c312ad0ede59"
|
||||
dependencies:
|
||||
async "^1.4.0"
|
||||
optimist "^0.6.1"
|
||||
@ -182,12 +255,12 @@ inherits@2, inherits@^2.0.1, inherits@~2.0.1:
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
|
||||
interpret@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
|
||||
|
||||
is-buffer@^1.0.2:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b"
|
||||
is-buffer@^1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc"
|
||||
|
||||
is-stream@^1.1.0:
|
||||
version "1.1.0"
|
||||
@ -201,43 +274,75 @@ isarray@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||
|
||||
js-yaml@^3.7.0:
|
||||
version "3.8.1"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.1.tgz#782ba50200be7b9e5a8537001b7804db3ad02628"
|
||||
js-yaml@^3.8.3:
|
||||
version "3.8.3"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.3.tgz#33a05ec481c850c8875929166fe1beb61c728766"
|
||||
dependencies:
|
||||
argparse "^1.0.7"
|
||||
esprima "^3.1.1"
|
||||
|
||||
jsonfile@^2.1.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
|
||||
jsonfile@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.0.tgz#92e7c7444e5ffd5fa32e6a9ae8b85034df8347d0"
|
||||
optionalDependencies:
|
||||
graceful-fs "^4.1.6"
|
||||
|
||||
kind-of@^3.0.2:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47"
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.0.tgz#b58abe4d5c044ad33726a8c1525b48cf891bff07"
|
||||
dependencies:
|
||||
is-buffer "^1.0.2"
|
||||
is-buffer "^1.1.5"
|
||||
|
||||
lazy-cache@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
|
||||
|
||||
leakage@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.2.0.tgz#9e7a8cc1d241d8c8427e348769e192e172fd8733"
|
||||
dependencies:
|
||||
left-pad "^1.1.3"
|
||||
memwatch-next "^0.3.0"
|
||||
minimist "^1.2.0"
|
||||
pretty-bytes "^4.0.2"
|
||||
|
||||
left-pad@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
||||
|
||||
lodash@^4.17.4:
|
||||
version "4.17.4"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||
|
||||
longest@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
|
||||
|
||||
memwatch-next@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
|
||||
dependencies:
|
||||
bindings "^1.2.1"
|
||||
nan "^2.3.2"
|
||||
|
||||
minimatch@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
||||
dependencies:
|
||||
brace-expansion "^1.0.0"
|
||||
|
||||
minimist@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||
|
||||
minimist@~0.0.1:
|
||||
version "0.0.10"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
|
||||
|
||||
nan@^2.3.2:
|
||||
version "2.6.2"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
||||
|
||||
once@^1.3.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
@ -267,20 +372,24 @@ pify@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
|
||||
|
||||
pretty-bytes@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||
|
||||
process-nextick-args@^1.0.6, process-nextick-args@~1.0.6:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
|
||||
|
||||
readable-stream@^2.0.2, readable-stream@^2.1.5:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.3.tgz#9cf49463985df016c8ae8813097a9293a9b33729"
|
||||
version "2.2.9"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8"
|
||||
dependencies:
|
||||
buffer-shims "^1.0.0"
|
||||
buffer-shims "~1.0.0"
|
||||
core-util-is "~1.0.0"
|
||||
inherits "~2.0.1"
|
||||
isarray "~1.0.0"
|
||||
process-nextick-args "~1.0.6"
|
||||
string_decoder "~0.10.x"
|
||||
string_decoder "~1.0.0"
|
||||
util-deprecate "~1.0.1"
|
||||
|
||||
rechoir@^0.6.2:
|
||||
@ -306,8 +415,8 @@ require-reload@0.2.2:
|
||||
resolved "https://registry.yarnpkg.com/require-reload/-/require-reload-0.2.2.tgz#29a7591846caf91b6e8a3cda991683f95f8d7d42"
|
||||
|
||||
resolve@^1.1.6:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.1.tgz#5d0a1632609b6b00a22284293db1d5d973676314"
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
|
||||
dependencies:
|
||||
path-parse "^1.0.5"
|
||||
|
||||
@ -321,39 +430,56 @@ semver@^5.3.0:
|
||||
version "5.3.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
||||
|
||||
shelljs@^0.7.4:
|
||||
version "0.7.6"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad"
|
||||
shelljs@^0.7.7:
|
||||
version "0.7.7"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1"
|
||||
dependencies:
|
||||
glob "^7.0.0"
|
||||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
smartfile@^4.1.4:
|
||||
version "4.1.6"
|
||||
resolved "https://registry.yarnpkg.com/smartfile/-/smartfile-4.1.6.tgz#d71026aefef99233c56766c3c6c11afc41a19b3a"
|
||||
smartchai@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
||||
dependencies:
|
||||
"@types/chai" "^3.4.35"
|
||||
"@types/chai-as-promised" "0.0.29"
|
||||
"@types/chai-string" "^1.1.30"
|
||||
chai "^3.5.0"
|
||||
chai-as-promised "^6.0.0"
|
||||
chai-string "^1.3.0"
|
||||
|
||||
smartdelay@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.1.tgz#687f8bcc09d7c62c9c5a8a1771c1aba3aff54156"
|
||||
dependencies:
|
||||
"@types/fs-extra" "0.x.x"
|
||||
"@types/vinyl" "^2.0.0"
|
||||
fs-extra "^2.0.0"
|
||||
glob "^7.1.1"
|
||||
js-yaml "^3.7.0"
|
||||
require-reload "0.2.2"
|
||||
smartpath "^3.2.7"
|
||||
smartq "^1.0.4"
|
||||
smartrequest "^1.0.4"
|
||||
typings-global "^1.0.14"
|
||||
vinyl "^2.0.1"
|
||||
|
||||
smartfile@^4.2.9:
|
||||
version "4.2.9"
|
||||
resolved "https://registry.yarnpkg.com/smartfile/-/smartfile-4.2.9.tgz#afcd1160049cbe26a86e42e842c86e8b748e69e7"
|
||||
dependencies:
|
||||
"@types/fs-extra" "2.x.x"
|
||||
"@types/vinyl" "^2.0.0"
|
||||
fs-extra "^3.0.0"
|
||||
glob "^7.1.1"
|
||||
js-yaml "^3.8.3"
|
||||
require-reload "0.2.2"
|
||||
smartpath "^3.2.8"
|
||||
smartq "^1.1.1"
|
||||
smartrequest "^1.0.4"
|
||||
typings-global "^1.0.16"
|
||||
vinyl "^2.0.2"
|
||||
vinyl-file "^3.0.0"
|
||||
|
||||
smartpath@^3.2.7:
|
||||
smartpath@^3.2.8:
|
||||
version "3.2.8"
|
||||
resolved "https://registry.yarnpkg.com/smartpath/-/smartpath-3.2.8.tgz#4834bd3a8bae2295baacadba23c87a501952f940"
|
||||
dependencies:
|
||||
home "^1.0.1"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
smartq@^1.0.4, smartq@^1.1.0:
|
||||
smartq@^1.1.0, smartq@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.1.tgz#efb358705260d41ae18aef7ffd815f7b6fe17dd3"
|
||||
dependencies:
|
||||
@ -381,9 +507,11 @@ sprintf-js@~1.0.2:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||
|
||||
string_decoder@~0.10.x:
|
||||
version "0.10.31"
|
||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
|
||||
string_decoder@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.0.tgz#f06f41157b664d86069f84bdbdc9b0d8ab281667"
|
||||
dependencies:
|
||||
buffer-shims "~1.0.0"
|
||||
|
||||
strip-bom-buf@^1.0.0:
|
||||
version "1.0.0"
|
||||
@ -404,6 +532,17 @@ strip-bom@^2.0.0:
|
||||
dependencies:
|
||||
is-utf8 "^0.2.0"
|
||||
|
||||
tapbundle@^1.0.10:
|
||||
version "1.0.10"
|
||||
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.0.10.tgz#36fd40036f6b5b738cbb9b5fc400df4c4031bc26"
|
||||
dependencies:
|
||||
early "^2.1.1"
|
||||
leakage "^0.2.0"
|
||||
smartchai "^1.0.3"
|
||||
smartdelay "^1.0.1"
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
through2@^2.0.1:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
|
||||
@ -411,37 +550,42 @@ through2@^2.0.1:
|
||||
readable-stream "^2.1.5"
|
||||
xtend "~4.0.1"
|
||||
|
||||
type-detect@0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
||||
|
||||
type-detect@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
|
||||
|
||||
typed-promisify@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
||||
|
||||
typings-global@*, typings-global@^1.0.14:
|
||||
version "1.0.14"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c"
|
||||
typings-global@^1.0.14, typings-global@^1.0.16:
|
||||
version "1.0.16"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.16.tgz#489b71781af24268750c2899316400a5e482961f"
|
||||
dependencies:
|
||||
semver "^5.3.0"
|
||||
shelljs "^0.7.4"
|
||||
|
||||
typings-test@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/typings-test/-/typings-test-1.0.3.tgz#fbab895eb3f0c44842e73db059f65946b971e369"
|
||||
dependencies:
|
||||
"@types/mocha" "^2.2.31"
|
||||
typings-global "*"
|
||||
shelljs "^0.7.7"
|
||||
|
||||
uglify-js@^2.6:
|
||||
version "2.7.5"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8"
|
||||
version "2.8.22"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.22.tgz#d54934778a8da14903fa29a326fb24c0ab51a1a0"
|
||||
dependencies:
|
||||
async "~0.2.6"
|
||||
source-map "~0.5.1"
|
||||
uglify-to-browserify "~1.0.0"
|
||||
yargs "~3.10.0"
|
||||
optionalDependencies:
|
||||
uglify-to-browserify "~1.0.0"
|
||||
|
||||
uglify-to-browserify@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
|
||||
|
||||
universalify@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.0.tgz#9eb1c4651debcc670cc94f1a75762332bb967778"
|
||||
|
||||
util-deprecate@~1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
@ -456,9 +600,9 @@ vinyl-file@^3.0.0:
|
||||
strip-bom-stream "^2.0.0"
|
||||
vinyl "^2.0.1"
|
||||
|
||||
vinyl@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.0.1.tgz#1c3b4931e7ac4c1efee743f3b91a74c094407bb6"
|
||||
vinyl@^2.0.1, vinyl@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.0.2.tgz#0a3713d8d4e9221c58f10ca16c0116c9e25eda7c"
|
||||
dependencies:
|
||||
clone "^1.0.0"
|
||||
clone-buffer "^1.0.0"
|
||||
|
Reference in New Issue
Block a user