implemented memory module
This commit is contained in:
parent
0661744614
commit
581b9e21d3
@ -3,8 +3,10 @@ make files easily accessible for processing in javascript.
|
||||
|
||||
## Status
|
||||
[![Build Status](https://travis-ci.org/pushrocks/smartfile.svg?branch=master)](https://travis-ci.org/pushrocks/smartfile)
|
||||
[![Dependency Status](https://david-dm.org/pushrocks/smartfile.svg)](https://david-dm.org/pushrocks/smartfile)
|
||||
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartfile/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartfile/master/dependencies/npm)
|
||||
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartfile/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartfile)
|
||||
[![codecov.io](https://codecov.io/github/pushrocks/smartfile/coverage.svg?branch=master)](https://codecov.io/github/pushrocks/smartfile?branch=master)
|
||||
|
||||
## Supported file types:
|
||||
* .yml .yaml
|
||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -5,6 +5,7 @@ var SmartfileChecks = require("./smartfile.checks");
|
||||
var SmartfileFsaction = require("./smartfile.fsaction");
|
||||
var SmartfileGet = require("./smartfile.get");
|
||||
var SmartfileLocal = require("./smartfile.local");
|
||||
var SmartfileMemory = require("./smartfile.memory");
|
||||
var SmartfileRemote = require("./smartfile.remote");
|
||||
var smartfile = {
|
||||
fsaction: SmartfileFsaction,
|
||||
@ -12,9 +13,10 @@ var smartfile = {
|
||||
checks: SmartfileChecks,
|
||||
get: SmartfileGet,
|
||||
local: SmartfileLocal,
|
||||
memory: SmartfileMemory,
|
||||
remote: SmartfileRemote,
|
||||
requireReload: SmartfileLocal.requireReload
|
||||
};
|
||||
module.exports = smartfile;
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFFNUMsSUFBTyxPQUFPLFdBQVcscUJBQX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ydGZpbGVHZXQsXG4gICAgbG9jYWw6IFNtYXJ0ZmlsZUxvY2FsLFxuICAgIG1lbW9yeTogU21hcnRmaWxlTWVtb3J5LFxuICAgIHJlbW90ZTogU21hcnRmaWxlUmVtb3RlLFxuICAgIHJlcXVpcmVSZWxvYWQ6IFNtYXJ0ZmlsZUxvY2FsLnJlcXVpcmVSZWxvYWRcbn07XG5cbmV4cG9ydCA9IHNtYXJ0ZmlsZTtcbiJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
||||
|
76
dist/smartfile.memory.js
vendored
Normal file
76
dist/smartfile.memory.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
dist/smartfile.plugins.js
vendored
2
dist/smartfile.plugins.js
vendored
@ -14,4 +14,4 @@ exports.yaml = require("js-yaml");
|
||||
exports.request = require("request");
|
||||
exports.requireReload = require("require-reload");
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDakMsaUJBQVMsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUM7QUFDakMsVUFBRSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUN6QixZQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ3ZCLFNBQUMsR0FBRztJQUNYLFNBQVMsRUFBRSxPQUFPLENBQUMsaUJBQWlCLENBQUM7Q0FDeEMsQ0FBQztBQUNTLFlBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDdkIsU0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNqQixhQUFLLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQ3pCLGlCQUFTLEdBQUcsT0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lbW90ZVNyYzogcmVxdWlyZShcImd1bHAtcmVtb3RlLXNyY1wiKVxufTtcbmV4cG9ydCBpbXBvcnQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpO1xuZXhwb3J0IGxldCBxID0gcmVxdWlyZShcInFcIik7XG5leHBvcnQgaW1wb3J0IHZpbnlsID0gcmVxdWlyZShcInZpbnlsXCIpO1xuZXhwb3J0IGxldCB2aW55bEZpbGUgPSByZXF1aXJlKFwidmlueWwtZmlsZVwiKTtcbmV4cG9ydCBsZXQgeWFtbCA9IHJlcXVpcmUoXCJqcy15YW1sXCIpO1xuZXhwb3J0IGxldCByZXF1ZXN0ID0gcmVxdWlyZShcInJlcXVlc3RcIik7XG5leHBvcnQgbGV0IHJlcXVpcmVSZWxvYWQgPSByZXF1aXJlKFwicmVxdWlyZS1yZWxvYWRcIik7XG4iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||
|
69
dist/smartfile.read.js
vendored
69
dist/smartfile.read.js
vendored
@ -1,69 +0,0 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
"use strict";
|
||||
var plugins = require("./smartfile.plugins");
|
||||
exports.toFS = function (options, cb) {
|
||||
if (cb === void 0) { cb = undefined; }
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @param fileTypeArg
|
||||
* @returns {any}
|
||||
*/
|
||||
exports.toObject = function (filePath, fileTypeArg) {
|
||||
if (fileTypeArg === void 0) { fileTypeArg = undefined; }
|
||||
var fileType;
|
||||
if (typeof fileTypeArg == "undefined") {
|
||||
fileType = plugins.path.extname(filePath);
|
||||
}
|
||||
else {
|
||||
fileType = fileTypeArg;
|
||||
}
|
||||
fileType = fileType.replace(/\.([a-z]*)/, "$1"); //remove . form fileType
|
||||
switch (fileType) {
|
||||
case "yml":
|
||||
case "yaml":
|
||||
try {
|
||||
return plugins.yaml.safeLoad(plugins.fs.readFileSync(filePath, 'utf8'));
|
||||
}
|
||||
catch (e) {
|
||||
plugins.beautylog.error("check that " + filePath.blue + " points to a valid file");
|
||||
}
|
||||
break;
|
||||
case "json":
|
||||
return plugins.fs.readJsonSync(filePath, {});
|
||||
default:
|
||||
plugins.beautylog.error("file type " + fileType.blue + " not supported");
|
||||
break;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* reads a file content to a String
|
||||
* @param filePath
|
||||
* @returns {string|Buffer|any}
|
||||
*/
|
||||
exports.toString = function (filePath) {
|
||||
var fileString;
|
||||
fileString = plugins.fs.readFileSync(filePath, "utf8");
|
||||
return fileString;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePathArg
|
||||
* @param options
|
||||
* @returns {number}
|
||||
*/
|
||||
exports.toVinyl = function (filePathArg, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
return plugins.vinylFile.readSync(filePathArg, options);
|
||||
};
|
||||
/**
|
||||
* lets you reload files hot.
|
||||
* @param path
|
||||
* @returns {any}
|
||||
*/
|
||||
exports.requireReload = function (path) {
|
||||
return plugins.requireReload(path);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5yZWFkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFFNUMsSUFBTyxPQUFPLFdBQVcscUJBQXFCLENBQUMsQ0FBQztBQUVyQyxZQUFJLEdBQUcsVUFBUyxPQUFtQyxFQUFFLEVBQVk7SUFBWixrQkFBWSxHQUFaLGNBQVk7QUFFNUUsQ0FBQyxDQUFDO0FBRUY7Ozs7O0dBS0c7QUFDUSxnQkFBUSxHQUFHLFVBQVMsUUFBUSxFQUFDLFdBQXVCO0lBQXZCLDJCQUF1QixHQUF2Qix1QkFBdUI7SUFDM0QsSUFBSSxRQUFRLENBQUM7SUFDYixFQUFFLENBQUMsQ0FBQyxPQUFPLFdBQVcsSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1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7XG4gICAgICAgICAgICBicmVhaztcbiAgICB9XG59O1xuXG4vKipcbiAqIHJlYWRzIGEgZmlsZSBjb250ZW50IHRvIGEgU3RyaW5nXG4gKiBAcGFyYW0gZmlsZVBhdGhcbiAqIEByZXR1cm5zIHtzdHJpbmd8QnVmZmVyfGFueX1cbiAqL1xuZXhwb3J0IGxldCB0b1N0cmluZyA9IGZ1bmN0aW9uKGZpbGVQYXRoKSB7XG4gICAgbGV0IGZpbGVTdHJpbmc7XG4gICAgZmlsZVN0cmluZyA9IHBsdWdpbnMuZnMucmVhZEZpbGVTeW5jKGZpbGVQYXRoLCBcInV0ZjhcIik7XG4gICAgcmV0dXJuIGZpbGVTdHJpbmc7XG59O1xuXG4vKipcbiAqXG4gKiBAcGFyYW0gZmlsZVBhdGhBcmdcbiAqIEBwYXJhbSBvcHRpb25zXG4gKiBAcmV0dXJucyB7bnVtYmVyfVxuICovXG5leHBvcnQgbGV0IHRvVmlueWwgPSBmdW5jdGlvbihmaWxlUGF0aEFyZyxvcHRpb25zID0ge30pIHtcbiAgICByZXR1cm4gcGx1Z2lucy52aW55bEZpbGUucmVhZFN5bmMoZmlsZVBhdGhBcmcsb3B0aW9ucyk7XG59O1xuXG4vKipcbiAqIGxldHMgeW91IHJlbG9hZCBmaWxlcyBob3QuXG4gKiBAcGFyYW0gcGF0aFxuICogQHJldHVybnMge2FueX1cbiAqL1xuZXhwb3J0IGxldCByZXF1aXJlUmVsb2FkID0gZnVuY3Rpb24ocGF0aDpzdHJpbmcpe1xuICAgIHJldHVybiBwbHVnaW5zLnJlcXVpcmVSZWxvYWQocGF0aCk7XG59OyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
69
dist/smartfile.simple.js
vendored
69
dist/smartfile.simple.js
vendored
@ -1,69 +0,0 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
"use strict";
|
||||
var plugins = require("./smartfile.plugins");
|
||||
exports.copy = function (fromArg, toArg) {
|
||||
plugins.shelljs.cp("-r", fromArg, toArg);
|
||||
};
|
||||
/**
|
||||
* reads a file content to a String
|
||||
* @param filePath
|
||||
* @returns {string|Buffer|any}
|
||||
*/
|
||||
exports.readFileToString = function (filePath) {
|
||||
var fileString;
|
||||
fileString = plugins.fs.readFileSync(filePath, "utf8");
|
||||
return fileString;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @param fileTypeArg
|
||||
* @returns {any}
|
||||
*/
|
||||
exports.readFileToObject = function (filePath, fileTypeArg) {
|
||||
if (fileTypeArg === void 0) { fileTypeArg = undefined; }
|
||||
var fileType;
|
||||
if (typeof fileTypeArg == "undefined") {
|
||||
fileType = plugins.path.extname(filePath);
|
||||
}
|
||||
else {
|
||||
fileType = fileTypeArg;
|
||||
}
|
||||
fileType = fileType.replace(/\.([a-z]*)/, "$1"); //remove . form fileType
|
||||
switch (fileType) {
|
||||
case "yml":
|
||||
case "yaml":
|
||||
try {
|
||||
return plugins.yaml.safeLoad(plugins.fs.readFileSync(filePath, 'utf8'));
|
||||
}
|
||||
catch (e) {
|
||||
plugins.beautylog.error("check that " + filePath.blue + " points to a valid file");
|
||||
}
|
||||
break;
|
||||
case "json":
|
||||
return plugins.fs.readJsonSync(filePath, {});
|
||||
default:
|
||||
plugins.beautylog.error("file type " + fileType.blue + " not supported");
|
||||
break;
|
||||
}
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePathArg
|
||||
* @param options
|
||||
* @returns {number}
|
||||
*/
|
||||
exports.readFileToVinyl = function (filePathArg, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
return plugins.vinylFile.readSync(filePathArg, options);
|
||||
};
|
||||
/**
|
||||
* lets you reload files hot.
|
||||
* @param path
|
||||
* @returns {any}
|
||||
*/
|
||||
exports.requireReload = function (path) {
|
||||
return plugins.requireReload(path);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5z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F0aEFyZyxvcHRpb25zID0ge30pIHtcbiAgICByZXR1cm4gcGx1Z2lucy52aW55bEZpbGUucmVhZFN5bmMoZmlsZVBhdGhBcmcsb3B0aW9ucyk7XG59O1xuXG4vKipcbiAqIGxldHMgeW91IHJlbG9hZCBmaWxlcyBob3QuXG4gKiBAcGFyYW0gcGF0aFxuICogQHJldHVybnMge2FueX1cbiAqL1xuZXhwb3J0IGxldCByZXF1aXJlUmVsb2FkID0gZnVuY3Rpb24ocGF0aDpzdHJpbmcpe1xuICAgIHJldHVybiBwbHVnaW5zLnJlcXVpcmVSZWxvYWQocGF0aCk7XG59OyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"mode":"default",
|
||||
"coveralls":true
|
||||
"codecov":true
|
||||
}
|
@ -37,8 +37,8 @@
|
||||
"vinyl-file": "2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-function": "^1.1.1",
|
||||
"npmts": "3.5.0",
|
||||
"should": "^8.2.2"
|
||||
"gulp-function": "^1.2.0",
|
||||
"npmts": "4.0.1",
|
||||
"should": "^8.3.0"
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5C,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7B,IAAI,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEzC,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAC;QACtB,QAAQ,C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E,CAAC;qBAC/G,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;qBACpD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,aAAa,EAAC;YACnB,EAAE,CAAC,yCAAyC,EAAC,UAAS,IAAI;gBACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACnB,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,8EAA8E,CAAC;qBACpG,IAAI,CAAC,UAAS,cAAc;oBACzB,MAAM,CAAC,KAAK,CAAC,cAAc,EAAC,sBAAsB,CAAC,CAAC;oBACpD,IAAI,EAAE,CAAC;gBACX,CAAC,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,gDAAgD,EAAC,UAAS,IAAI;gBAC7D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACpB,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,qCAAqC,CAAC;qBAC3D,IAAI,CAAC;oBACF,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;gBACxD,CAAC,EAAC;oBACE,IAAI,EAAE,CAAC;gBACX,CAAC,CAAC,CAAA;YACV,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAC"}
|
@ -37,7 +37,9 @@ describe("smartfile".yellow,function(){
|
||||
it("should remove an entire directory",function(){
|
||||
|
||||
});
|
||||
it("should remove single files")
|
||||
it("should remove single files",function(){
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
describe(".local".yellow,function(){
|
||||
@ -99,6 +101,7 @@ describe("smartfile".yellow,function(){
|
||||
});
|
||||
});
|
||||
it("should reject a Promise when the link is false",function(done){
|
||||
this.timeout(10000);
|
||||
smartfile.remote.toString("https://push.rocks/doesnotexist.txt")
|
||||
.then(function(){
|
||||
throw new Error("this test should not be resolved");
|
||||
|
@ -5,6 +5,7 @@ import SmartfileChecks = require("./smartfile.checks");
|
||||
import SmartfileFsaction = require("./smartfile.fsaction");
|
||||
import SmartfileGet = require("./smartfile.get");
|
||||
import SmartfileLocal = require("./smartfile.local");
|
||||
import SmartfileMemory = require("./smartfile.memory");
|
||||
import SmartfileRemote = require("./smartfile.remote");
|
||||
|
||||
|
||||
@ -14,6 +15,7 @@ var smartfile:any = {
|
||||
checks: SmartfileChecks,
|
||||
get: SmartfileGet,
|
||||
local: SmartfileLocal,
|
||||
memory: SmartfileMemory,
|
||||
remote: SmartfileRemote,
|
||||
requireReload: SmartfileLocal.requireReload
|
||||
};
|
||||
|
82
ts/smartfile.memory.ts
Normal file
82
ts/smartfile.memory.ts
Normal file
@ -0,0 +1,82 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
|
||||
import plugins = require("./smartfile.plugins");
|
||||
let Readable = require("stream").Readable;
|
||||
/**
|
||||
* allows you to create a gulp stream from filestring
|
||||
* @param fileArg
|
||||
* @returns stream.Readable
|
||||
* @TODO: make it async;
|
||||
*/
|
||||
export let toGulpStream = function(fileArg:string|string[]|plugins.vinyl|plugins.vinyl[],baseArg?:string){
|
||||
let fileArray = [];
|
||||
|
||||
if(typeof fileArg === "string" || fileArg instanceof plugins.vinyl){ // make sure we work with an array later on
|
||||
fileArray.push(fileArg);
|
||||
} else if (Array.isArray(fileArg)){
|
||||
fileArray = fileArg;
|
||||
} else {
|
||||
throw new Error("fileArg has unknown format");
|
||||
}
|
||||
|
||||
let vinylFileArray:plugins.vinyl[] = []; //we want to have an array of vinylFiles
|
||||
|
||||
for (let fileIndexArg in fileArray){ //convert fileArray in vinylArray
|
||||
let file = fileArray[fileIndexArg];
|
||||
file instanceof plugins.vinyl ?
|
||||
vinylFileArray.push(file) :
|
||||
vinylFileArray.push(toVinylFileSync(file,{filename:fileIndexArg,base:"/"}));
|
||||
};
|
||||
|
||||
let stream = new Readable({ objectMode: true });
|
||||
for(let vinylFileIndexArg in vinylFileArray){
|
||||
let vinylFile = vinylFileArray[vinylFileIndexArg];
|
||||
stream.push(vinylFile);
|
||||
};
|
||||
stream.push(null); //signal end of stream;
|
||||
return stream;
|
||||
};
|
||||
|
||||
/**
|
||||
* takes a string and converts it to vinyl file
|
||||
* @param fileArg
|
||||
* @param optionsArg
|
||||
*/
|
||||
export let toVinylFileSync = function(fileArg:string,optionsArg?:{filename:string,base:string,relPath?:string}){
|
||||
optionsArg? void(0) : optionsArg = {filename: "vinylfile", base: "/"};
|
||||
optionsArg.filename ? void(0) : optionsArg.filename = "vinylfile";
|
||||
optionsArg.base ? void(0) : optionsArg.base = "/";
|
||||
optionsArg.relPath ? void("0") : optionsArg.relPath = "";
|
||||
let vinylFile = new plugins.vinyl({
|
||||
base: optionsArg.base,
|
||||
path: plugins.path.join(optionsArg.base,optionsArg.relPath,optionsArg.filename),
|
||||
contents: new Buffer(fileArg)
|
||||
});
|
||||
return vinylFile;
|
||||
};
|
||||
|
||||
/**
|
||||
* takes a string array and some options and returns a vinylfile array
|
||||
* @param arrayArg
|
||||
* @param optionsArg
|
||||
*/
|
||||
export let toVinylArraySync = function(arrayArg:string[],optionsArg?:{filename:string,base:string,relPath?:string}){
|
||||
let vinylArray = [];
|
||||
for(let stringIndexArg in arrayArg){
|
||||
let myString = arrayArg[stringIndexArg];
|
||||
vinylArray.push(toVinylFileSync(myString,optionsArg));
|
||||
}
|
||||
return vinylArray;
|
||||
};
|
||||
|
||||
|
||||
export let toFs = function(fileArg:string|plugins.vinyl,fileNameArg?:string,fileBaseArg?:string){
|
||||
if (fileArg instanceof plugins.vinyl){
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
export let toFsSync = function(){
|
||||
|
||||
};
|
||||
|
@ -5,9 +5,9 @@ export let gulp = require("gulp");
|
||||
export let g = {
|
||||
remoteSrc: require("gulp-remote-src")
|
||||
};
|
||||
export let path = require("path");
|
||||
export import path = require("path");
|
||||
export let q = require("q");
|
||||
export let vinyl = require("vinyl");
|
||||
export import vinyl = require("vinyl");
|
||||
export let vinylFile = require("vinyl-file");
|
||||
export let yaml = require("js-yaml");
|
||||
export let request = require("request");
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"browserify": "github:DefinitelyTyped/DefinitelyTyped/browserify/browserify.d.ts",
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts",
|
||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
||||
"node": "registry:dt/node#4.0.0+20160311162451"
|
||||
"node": "registry:dt/node",
|
||||
"vinyl": "registry:dt/vinyl"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user