User/matwils/example clean (#17)
* Removing legacy examples. * Updating the Http plugin sample.
This commit is contained in:
Родитель
1dba21c376
Коммит
d587dca3a2
|
@ -24,6 +24,9 @@
|
|||
.settings/
|
||||
/ssl
|
||||
*.log
|
||||
bin/
|
||||
obj/
|
||||
.vs/
|
||||
|
||||
# test
|
||||
**/*junit*.xml
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -15,6 +15,7 @@ namespace Microsoft.ManagementExperience.Samples
|
|||
/// <summary>
|
||||
/// Represents a sample HTTP plug-in.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SampleHttpPlugIn : HttpPlugIn
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"presets": ["es2015"]
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
# THIS FILE WAS GENERATED FROM msft-sme-build. DO NOT MODIFY. To change this file, make the appropriate changes in build
|
||||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.ts]
|
||||
indent_size = 4
|
||||
|
||||
[*.js]
|
||||
indent_size = 4
|
||||
|
||||
[*.css]
|
||||
indent_size = 4
|
|
@ -1,51 +0,0 @@
|
|||
{
|
||||
"__COMMENT_NOTICE__": "Normally, this file supports comments. However if comments are present the whole file may be overridden by msft-sme-build.",
|
||||
"__MERGE_NOTICE__": "THIS FILE WAS MERGED FROM msft-sme-build. some properties in this file may be overridden if changed.",
|
||||
"__MORE_INFROMATION__": "For more information about this file, visit: https://go.microsoft.com/fwlink/?linkid=830387",
|
||||
"configurations": [
|
||||
{
|
||||
"args": [
|
||||
"generate-resjson-interface"
|
||||
],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"name": "gulp debug",
|
||||
"outFiles": [
|
||||
],
|
||||
"program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
|
||||
"request": "launch",
|
||||
"sourceMaps": true,
|
||||
"stopOnEntry": false,
|
||||
"type": "node"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"build"
|
||||
],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"name": "Build",
|
||||
"outFiles": [
|
||||
],
|
||||
"program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
|
||||
"request": "launch",
|
||||
"sourceMaps": true,
|
||||
"stopOnEntry": false,
|
||||
"type": "node"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"test"
|
||||
],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"name": "test",
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/dist/**/*.js"
|
||||
],
|
||||
"program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
|
||||
"request": "launch",
|
||||
"sourceMaps": true,
|
||||
"stopOnEntry": false,
|
||||
"type": "node2"
|
||||
}
|
||||
],
|
||||
"version": "0.2.0"
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"__COMMENT_NOTICE__": "Normally, this file supports comments. However if comments are present the whole file may be overridden by msft-sme-build.",
|
||||
"__MERGE_NOTICE__": "THIS FILE WAS MERGED FROM msft-sme-build. some properties in this file may be overridden if changed.",
|
||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
"__APPS_PROP__": "The first item in the 'apps' object is expected to be the main application. Additional items will be left alone",
|
||||
"__MERGE_NOTICE__": "THIS FILE WAS MERGED FROM msft-sme-build. some properties in this file may be overridden if changed.",
|
||||
"apps": [
|
||||
{
|
||||
"assets": [
|
||||
"assets",
|
||||
"manifest.json"
|
||||
],
|
||||
"environmentSource": "environments/environment.ts",
|
||||
"environments": {
|
||||
"dev": "environments/environment.ts",
|
||||
"prod": "environments/environment.prod.ts"
|
||||
},
|
||||
"index": "index.html",
|
||||
"main": "main.ts",
|
||||
"outDir": "bundle",
|
||||
"root": "src",
|
||||
"scripts": [
|
||||
"../node_modules/jquery/dist/jquery.min.js",
|
||||
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
|
||||
],
|
||||
"styles": [
|
||||
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||
"../node_modules/@msft-sme/shell/dist/angular/assets/sme-icons/css/sme-icons.css",
|
||||
"../node_modules/@msft-sme/shell/dist/angular/assets/winstrap-tmp/css/winstrap.min.css",
|
||||
"../node_modules/@msft-sme/shell/dist/angular/assets/winstrap-tmp/css/winstrap-optional.min.css",
|
||||
"../node_modules/primeng/resources/primeng.min.css",
|
||||
"../node_modules/primeng/resources/themes/bootstrap/theme.css"
|
||||
],
|
||||
"tsconfig": "tsconfig.json"
|
||||
}
|
||||
],
|
||||
"defaults": {
|
||||
"inline": {
|
||||
"style": false,
|
||||
"template": false
|
||||
},
|
||||
"prefixInterfaces": false,
|
||||
"styleExt": "css"
|
||||
},
|
||||
"project": {
|
||||
"name": "hello-world",
|
||||
"version": "1.0.0-beta.25.5"
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const clean = require('gulp-clean');
|
||||
const ngCompile = require('gulp-ngc');
|
||||
const gulpTslint = require('gulp-tslint');
|
||||
const tslint = require('tslint');
|
||||
const argv = require('yargs').argv;
|
||||
const runSequence = require('run-sequence');
|
||||
const inlineNg2Template = require('gulp-inline-ng2-template');
|
||||
const child_process = require('child_process');
|
||||
const gulpPsCode = require('./gulps/gulp-ps-code');
|
||||
const gulpResJson = require('./gulps/gulp-resjson');
|
||||
const gulpSvgCode = require('./gulps/gulp-svg-code');
|
||||
const gulpMergeJsonInFolders = require('./gulps/gulp-merge-json-in-folders');
|
||||
|
||||
gulp.task('clean', () => {
|
||||
return gulp.src(['dist', 'bundle', 'src/generated', 'src/assets/strings', 'inlineSrc'], { read: false })
|
||||
.pipe(clean({ force: true }));
|
||||
});
|
||||
|
||||
gulp.task('generate-powershell', () => {
|
||||
return gulp.src(['src/resources/scripts/**/*.ps1'])
|
||||
.pipe(gulpPsCode({ name: 'powershell-scripts.ts', removeComments: true }))
|
||||
.pipe(gulp.dest('src/generated'));
|
||||
});
|
||||
|
||||
gulp.task('generate-svg', () => {
|
||||
return gulp.src(['src/resources/icons/**/*.svg'])
|
||||
.pipe(gulpSvgCode())
|
||||
.pipe(gulp.dest('src/generated'));
|
||||
});
|
||||
|
||||
gulp.task('generate-resjson-json', () => {
|
||||
return gulp.src(['src/resources/strings/**/*.resjson'])
|
||||
.pipe(gulpResJson({ json: true }))
|
||||
.pipe(gulp.dest('./src/assets/strings'));
|
||||
});
|
||||
|
||||
gulp.task('generate-resjson-interface', () => {
|
||||
return gulp.src(['src/resources/strings/**/*.resjson'])
|
||||
.pipe(gulpResJson({ typescript: 'interface' }))
|
||||
.pipe(gulp.dest('src/generated'));
|
||||
});
|
||||
|
||||
gulp.task('merge-localized-json', () => {
|
||||
return gulp.src(['./node_modules/@msft-sme/**/dist/assets/strings'])
|
||||
.pipe(gulpMergeJsonInFolders({ src: './src/assets/strings' }))
|
||||
.pipe(gulp.dest('./src/assets/strings'));
|
||||
});
|
||||
|
||||
gulp.task('generate-resjson', (cb) => {
|
||||
runSequence(['generate-resjson-json', 'generate-resjson-interface'], 'merge-localized-json', cb);
|
||||
});
|
||||
|
||||
gulp.task('generate', (cb) => {
|
||||
runSequence(['generate-powershell', 'generate-svg', 'generate-resjson'], cb);
|
||||
});
|
||||
|
||||
gulp.task('lint', () => {
|
||||
var program = tslint.Linter.createProgram("./tsconfig.json");
|
||||
return gulp.src('src/**/*.ts')
|
||||
.pipe(gulpTslint({ program }))
|
||||
.pipe(gulpTslint.report({
|
||||
"emitError": true,
|
||||
"reportLimit": 0,
|
||||
"summarizeFailureOutput": true
|
||||
}));
|
||||
});
|
||||
|
||||
gulp.task('inline', function() {
|
||||
return gulp.src('./src/**/*.ts')
|
||||
.pipe(inlineNg2Template({ useRelativePaths: true }))
|
||||
.pipe(gulp.dest('inlineSrc'));
|
||||
});
|
||||
|
||||
gulp.task('copy', () => {
|
||||
return gulp.src(['src/**/*.json', 'src/**/*.d.ts', 'src/assets/**/*.*'], { base: 'src' })
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('compile', () => {
|
||||
return ngCompile('./tsconfig-inline.json');
|
||||
});
|
||||
|
||||
gulp.task('bundle', cb => {
|
||||
var args = process.argv.slice(3);
|
||||
args.splice(0, 0, 'build', '-progress=false');
|
||||
var cmd = child_process.spawn('ng.cmd', args);
|
||||
cmd.stdout.on('data', function (data) { gutil.log(data.toString()); });
|
||||
cmd.stderr.on('data', function (data) { gutil.log(data.toString()); });
|
||||
cmd.on('exit', function (code) { cb(); });
|
||||
});
|
||||
|
||||
gulp.task('serve', (cb) => {
|
||||
var args = process.argv.slice(3);
|
||||
args.splice(0, 0, 'serve', '-progress=false');
|
||||
var cmd = child_process.spawn('ng.cmd', args);
|
||||
cmd.stdout.on('data', function (data) { gutil.log(data.toString()); });
|
||||
cmd.stderr.on('data', function (data) { gutil.log(data.toString()); });
|
||||
cmd.on('exit', function (code) { cb(); });
|
||||
});
|
||||
|
||||
gulp.task('build', (cb) => {
|
||||
runSequence('clean', 'generate', 'lint', 'inline', ['compile', 'copy'], 'bundle', cb);
|
||||
});
|
|
@ -1,57 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
exports.__esModule = true;
|
||||
var gutil = require("gulp-util");
|
||||
var through2 = require("through2");
|
||||
var jsonMerge = require("./json-merge");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-merge-json-in-folders';
|
||||
function gulpMergeJsonInFolders(options) {
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
return pError;
|
||||
}
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// source path of current folder for 'strings.json'
|
||||
// src: string;
|
||||
//
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({ src: './src/assets/strings' }, options || {});
|
||||
var externalSources = [];
|
||||
return through2.obj(
|
||||
/**
|
||||
* @this {Transform}
|
||||
*/
|
||||
function (file, encoding, callback) {
|
||||
if (file.isDirectory()) {
|
||||
externalSources.push(file.path);
|
||||
}
|
||||
callback();
|
||||
},
|
||||
/**
|
||||
* @this {Flush}
|
||||
*/
|
||||
function (callback) {
|
||||
var _this = this;
|
||||
try {
|
||||
var merge = new jsonMerge.JsonMerge();
|
||||
var files = merge.mergeJsonInFolders(options.src, externalSources);
|
||||
files.forEach(function (file) { return _this.push(file); });
|
||||
}
|
||||
catch (e) {
|
||||
var error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
gutil.log(error);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
;
|
||||
module.exports = gulpMergeJsonInFolders;
|
|
@ -1,65 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
import gutil = require('gulp-util');
|
||||
import through2 = require('through2');
|
||||
import jsonMerge = require('./json-merge');
|
||||
|
||||
let PluginError = gutil.PluginError;
|
||||
let PLUGIN_NAME = 'gulp-merge-json-in-folders';
|
||||
|
||||
function gulpMergeJsonInFolders(options) {
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
|
||||
return pError;
|
||||
}
|
||||
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// source path of current folder for 'strings.json'
|
||||
// src: string;
|
||||
//
|
||||
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({ src: './src/assets/strings' }, options || {});
|
||||
|
||||
let externalSources: string[] = [];
|
||||
|
||||
return through2.obj(
|
||||
/**
|
||||
* @this {Transform}
|
||||
*/
|
||||
function (file, encoding, callback) {
|
||||
if (file.isDirectory()) {
|
||||
externalSources.push(file.path);
|
||||
}
|
||||
|
||||
callback();
|
||||
},
|
||||
|
||||
/**
|
||||
* @this {Flush}
|
||||
*/
|
||||
function (callback) {
|
||||
try {
|
||||
const merge = new jsonMerge.JsonMerge();
|
||||
const files = merge.mergeJsonInFolders(options.src, externalSources);
|
||||
files.forEach(file => this.push(file));
|
||||
} catch (e) {
|
||||
let error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
gutil.log(error);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
module.exports = gulpMergeJsonInFolders;
|
|
@ -1,122 +0,0 @@
|
|||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var fs = require('fs');
|
||||
var fsPath = require('path');
|
||||
var readlineSync = require('readline-sync');
|
||||
var gutil = require('gulp-util');
|
||||
var Vinyl = require('vinyl');
|
||||
var JsonMerge = (function () {
|
||||
function JsonMerge() {
|
||||
}
|
||||
/**
|
||||
* Recursively merges JSON files with the same name and same subPath from the sourceFolders into the JSON files
|
||||
* in the targetFolderPath.
|
||||
*
|
||||
* @example
|
||||
* src/assets/resources/strings/ <- targetFolderPath
|
||||
* strings.json
|
||||
* es/strings.json
|
||||
* pt/strings.json
|
||||
* [
|
||||
* 'node_modules/@msft-sme/core/dist/assets/resources/strings',
|
||||
* 'node_modules/@msft-sme/ng2/dist/assets/resources/strings'
|
||||
* ] <- sourceFoldersPath
|
||||
*
|
||||
* src/assets/resources/strings/strings.json contents are merged with the contents of
|
||||
* node_modules/@msft-sme/core/dist/assets/resources/strings/strings.json and
|
||||
* node_modules/@msft-ng2/core/dist/assets/resources/strings/strings.json
|
||||
* and the source file is overwritten by the merged content
|
||||
*
|
||||
* @param targetFolderPathRoot {string} The path of the base folder where the destination files are placed.
|
||||
* @param sourceFoldersPathRoot {string[]} The array of paths to the source folders from where to read the JSON files to merge
|
||||
*/
|
||||
JsonMerge.prototype.mergeJsonInFolders = function (targetFolderPathRoot, sourceFoldersPathRoot) {
|
||||
var _this = this;
|
||||
var outputFiles = [];
|
||||
var targetFilesContentMap = {};
|
||||
var targetFiles = this.getFilePaths(targetFolderPathRoot);
|
||||
targetFiles.forEach(function (targetFile) {
|
||||
var relativePath = targetFile.substring(targetFolderPathRoot.length + 1, targetFile.length);
|
||||
targetFilesContentMap[relativePath] = _this.readJSON(targetFile);
|
||||
});
|
||||
sourceFoldersPathRoot.forEach(function (sourceFolderPathRoot) {
|
||||
var sourceFiles = _this.getFilePaths(sourceFolderPathRoot);
|
||||
sourceFiles.forEach(function (sourceFile) {
|
||||
var relativePath = sourceFile.substring(sourceFolderPathRoot.length + 1, sourceFile.length);
|
||||
var sourceJson = _this.readJSON(sourceFile);
|
||||
_this.mergeJsons(relativePath, sourceJson, targetFilesContentMap);
|
||||
});
|
||||
});
|
||||
Object.keys(targetFilesContentMap).forEach(function (path) {
|
||||
var jsonFile = new Vinyl({
|
||||
cwd: './',
|
||||
path: path,
|
||||
contents: new Buffer(JSON.stringify(targetFilesContentMap[path]))
|
||||
});
|
||||
outputFiles.push(jsonFile);
|
||||
});
|
||||
return outputFiles;
|
||||
};
|
||||
JsonMerge.prototype.getFilePaths = function (dir, paths) {
|
||||
var _this = this;
|
||||
if (paths === void 0) { paths = []; }
|
||||
if (!dir.endsWith('/')) {
|
||||
dir += '/';
|
||||
}
|
||||
var files = fs.readdirSync(dir);
|
||||
files.forEach(function (file) {
|
||||
var filePath = dir + file;
|
||||
if (fs.statSync(filePath).isDirectory()) {
|
||||
paths.concat(_this.getFilePaths(filePath, paths));
|
||||
}
|
||||
else {
|
||||
paths.push(dir + file);
|
||||
}
|
||||
});
|
||||
return paths;
|
||||
};
|
||||
JsonMerge.prototype.mergeJsons = function (relativePath, sourceJson, targetFilesContentMap) {
|
||||
if (targetFilesContentMap[relativePath]) {
|
||||
this.extend(targetFilesContentMap[relativePath], [sourceJson]);
|
||||
}
|
||||
else {
|
||||
targetFilesContentMap[relativePath] = sourceJson;
|
||||
}
|
||||
};
|
||||
JsonMerge.prototype.readJSON = function (path) {
|
||||
return JSON.parse(fs.readFileSync(path, 'utf8'));
|
||||
};
|
||||
JsonMerge.prototype.isObject = function (value) {
|
||||
return value !== null && typeof value === 'object';
|
||||
};
|
||||
JsonMerge.prototype.isFunction = function (value) {
|
||||
return typeof value === 'function';
|
||||
};
|
||||
JsonMerge.prototype.extend = function (dest, sources) {
|
||||
if (!sources || sources.length === 0) {
|
||||
return dest;
|
||||
}
|
||||
for (var i = 0; i < sources.length; i++) {
|
||||
var src = sources[i];
|
||||
// Cant extend primitives or null/undefined values. so skip them
|
||||
if (!this.isObject(src) && !this.isFunction(src)) {
|
||||
continue;
|
||||
}
|
||||
var keys = Object.keys(src);
|
||||
var ki = keys.length;
|
||||
while (ki--) {
|
||||
var srcField = keys[ki];
|
||||
var srcValue = src[srcField];
|
||||
var destValue = srcValue;
|
||||
if (this.isObject(srcValue) && !Array.isArray(srcValue)) {
|
||||
destValue = {};
|
||||
this.extend(destValue, [dest[srcField], srcValue]);
|
||||
}
|
||||
dest[srcField] = destValue;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
};
|
||||
return JsonMerge;
|
||||
}());
|
||||
exports.JsonMerge = JsonMerge;
|
|
@ -1,135 +0,0 @@
|
|||
const fs = require('fs');
|
||||
const fsPath = require('path');
|
||||
const readlineSync = require('readline-sync');
|
||||
const gutil = require('gulp-util');
|
||||
const Vinyl = require('vinyl');
|
||||
|
||||
export interface Options {
|
||||
// source folder
|
||||
src: string;
|
||||
}
|
||||
|
||||
export class JsonMerge {
|
||||
/**
|
||||
* Recursively merges JSON files with the same name and same subPath from the sourceFolders into the JSON files
|
||||
* in the targetFolderPath.
|
||||
*
|
||||
* @example
|
||||
* src/assets/resources/strings/ <- targetFolderPath
|
||||
* strings.json
|
||||
* es/strings.json
|
||||
* pt/strings.json
|
||||
* [
|
||||
* 'node_modules/@msft-sme/core/dist/assets/resources/strings',
|
||||
* 'node_modules/@msft-sme/ng2/dist/assets/resources/strings'
|
||||
* ] <- sourceFoldersPath
|
||||
*
|
||||
* src/assets/resources/strings/strings.json contents are merged with the contents of
|
||||
* node_modules/@msft-sme/core/dist/assets/resources/strings/strings.json and
|
||||
* node_modules/@msft-ng2/core/dist/assets/resources/strings/strings.json
|
||||
* and the source file is overwritten by the merged content
|
||||
*
|
||||
* @param targetFolderPathRoot {string} The path of the base folder where the destination files are placed.
|
||||
* @param sourceFoldersPathRoot {string[]} The array of paths to the source folders from where to read the JSON files to merge
|
||||
*/
|
||||
public mergeJsonInFolders(targetFolderPathRoot: string, sourceFoldersPathRoot: string[]): any[] {
|
||||
const outputFiles: any[] = [];
|
||||
const targetFilesContentMap = {};
|
||||
let targetFiles = this.getFilePaths(targetFolderPathRoot);
|
||||
targetFiles.forEach((targetFile) => {
|
||||
let relativePath = targetFile.substring(targetFolderPathRoot.length + 1, targetFile.length);
|
||||
targetFilesContentMap[relativePath] = this.readJSON(targetFile);
|
||||
|
||||
});
|
||||
|
||||
sourceFoldersPathRoot.forEach((sourceFolderPathRoot) => {
|
||||
let sourceFiles = this.getFilePaths(sourceFolderPathRoot);
|
||||
sourceFiles.forEach((sourceFile) => {
|
||||
let relativePath = sourceFile.substring(sourceFolderPathRoot.length + 1, sourceFile.length);
|
||||
let sourceJson = this.readJSON(sourceFile);
|
||||
|
||||
this.mergeJsons(relativePath, sourceJson, targetFilesContentMap);
|
||||
});
|
||||
});
|
||||
|
||||
Object.keys(targetFilesContentMap).forEach(path => {
|
||||
let jsonFile = new Vinyl({
|
||||
cwd: './',
|
||||
path: path,
|
||||
contents: new Buffer(JSON.stringify(targetFilesContentMap[path]))
|
||||
});
|
||||
outputFiles.push(jsonFile);
|
||||
});
|
||||
|
||||
return outputFiles;
|
||||
}
|
||||
|
||||
private getFilePaths(dir, paths: string[] = []): string[] {
|
||||
if (!dir.endsWith('/')) {
|
||||
dir += '/';
|
||||
}
|
||||
|
||||
let files = fs.readdirSync(dir);
|
||||
files.forEach(file => {
|
||||
let filePath = dir + file;
|
||||
if (fs.statSync(filePath).isDirectory()) {
|
||||
paths.concat(this.getFilePaths(filePath, paths));
|
||||
} else {
|
||||
paths.push(dir + file);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
private mergeJsons(relativePath: string, sourceJson: any, targetFilesContentMap: {}): void {
|
||||
if (targetFilesContentMap[relativePath]) {
|
||||
this.extend(targetFilesContentMap[relativePath], [sourceJson]);
|
||||
} else {
|
||||
targetFilesContentMap[relativePath] = sourceJson;
|
||||
}
|
||||
}
|
||||
|
||||
private readJSON(path: string): any {
|
||||
return JSON.parse(fs.readFileSync(path, 'utf8'));
|
||||
}
|
||||
|
||||
private isObject(value): boolean {
|
||||
return value !== null && typeof value === 'object';
|
||||
}
|
||||
|
||||
private isFunction(value): boolean {
|
||||
return typeof value === 'function';
|
||||
}
|
||||
|
||||
private extend(dest: any, sources: any[]): any {
|
||||
if (!sources || sources.length === 0) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
for (let i = 0; i < sources.length; i++) {
|
||||
let src = sources[i];
|
||||
// Cant extend primitives or null/undefined values. so skip them
|
||||
if (!this.isObject(src) && !this.isFunction(src)) {
|
||||
continue;
|
||||
}
|
||||
let keys = Object.keys(src);
|
||||
let ki = keys.length;
|
||||
while (ki--) {
|
||||
let srcField = keys[ki];
|
||||
let srcValue = src[srcField];
|
||||
let destValue = srcValue;
|
||||
|
||||
if (this.isObject(srcValue) && !Array.isArray(srcValue)) {
|
||||
destValue = {};
|
||||
this.extend(destValue, [dest[srcField], srcValue]);
|
||||
}
|
||||
|
||||
dest[srcField] = destValue;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
exports.__esModule = true;
|
||||
var through2 = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var Path = require("path");
|
||||
var Vinyl = require("vinyl");
|
||||
var PsCode = require("./ps-code-convert");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-ps-code';
|
||||
/**
|
||||
* Plugin level function
|
||||
*/
|
||||
function gulpPsCode(options) {
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// name of generated file.
|
||||
// name: string; default is 'powershell-script.ts'
|
||||
//
|
||||
// remove comments at default:
|
||||
// noComments: boolean;
|
||||
//
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({ name: 'powershell-scripts.ts' }, options || {});
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
return pError;
|
||||
}
|
||||
var collection = {};
|
||||
var lastFile = null;
|
||||
return through2.obj(function (file, enc, cb) {
|
||||
var error = null;
|
||||
try {
|
||||
var path = Path.parse(file.path);
|
||||
if (path.ext === '.ps1') {
|
||||
if (collection[path.base]) {
|
||||
throw new Error('gulp-ps-code requires unique name of ps file, conflicted with ' + path.base);
|
||||
}
|
||||
var data = file.contents.toString('utf8');
|
||||
collection[path.base] = data;
|
||||
lastFile = file;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
return cb(error);
|
||||
}, function (cb) {
|
||||
var converter = new PsCode.PsCodeConverter();
|
||||
converter.contentReset();
|
||||
converter.generate(collection);
|
||||
var tsFile = new Vinyl({
|
||||
cwd: lastFile.cwd,
|
||||
base: lastFile.base,
|
||||
path: lastFile.base + '/' + options.name,
|
||||
contents: new Buffer(converter.content)
|
||||
});
|
||||
this.push(tsFile);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
module.exports = gulpPsCode;
|
|
@ -1,81 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
|
||||
import through2 = require('through2');
|
||||
import gutil = require('gulp-util');
|
||||
import Path = require('path');
|
||||
import Vinyl = require('vinyl');
|
||||
import PsCode = require('./ps-code-convert');
|
||||
|
||||
let PluginError = gutil.PluginError;
|
||||
let PLUGIN_NAME = 'gulp-ps-code';
|
||||
|
||||
/**
|
||||
* Plugin level function
|
||||
*/
|
||||
function gulpPsCode(options) {
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// name of generated file.
|
||||
// name: string; default is 'powershell-script.ts'
|
||||
//
|
||||
// remove comments at default:
|
||||
// noComments: boolean;
|
||||
//
|
||||
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({ name: 'powershell-scripts.ts' }, options || {});
|
||||
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
|
||||
return pError;
|
||||
}
|
||||
|
||||
let collection = {};
|
||||
let lastFile = null;
|
||||
|
||||
return through2.obj(
|
||||
function (file, enc, cb) {
|
||||
let error = null;
|
||||
try {
|
||||
let path = Path.parse(file.path);
|
||||
if (path.ext === '.ps1') {
|
||||
if (collection[path.base]) {
|
||||
throw new Error('gulp-ps-code requires unique name of ps file, conflicted with ' + path.base);
|
||||
}
|
||||
|
||||
let data = file.contents.toString('utf8');
|
||||
collection[path.base] = data;
|
||||
lastFile = file;
|
||||
}
|
||||
} catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
|
||||
return cb(error);
|
||||
},
|
||||
function (cb) {
|
||||
let converter = new PsCode.PsCodeConverter();
|
||||
converter.contentReset();
|
||||
converter.generate(collection);
|
||||
|
||||
let tsFile = new Vinyl({
|
||||
cwd: lastFile.cwd,
|
||||
base: lastFile.base,
|
||||
path: lastFile.base + '/' + options.name,
|
||||
contents: new Buffer(converter.content)
|
||||
});
|
||||
this.push(tsFile);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = gulpPsCode;
|
|
@ -1,110 +0,0 @@
|
|||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var PsCodeConverter = (function () {
|
||||
function PsCodeConverter(options) {
|
||||
this.options = options;
|
||||
this.options = options ? options : { noComments: true, name: 'powershell-scripts.ts' };
|
||||
if (!this.options.hasOwnProperty('noComments')) {
|
||||
this.options.noComments = true;
|
||||
}
|
||||
}
|
||||
Object.defineProperty(PsCodeConverter.prototype, "content", {
|
||||
get: function () {
|
||||
return this.buffer.join('');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
PsCodeConverter.prototype.contentReset = function () {
|
||||
this.buffer = [];
|
||||
};
|
||||
PsCodeConverter.prototype.generate = function (collection) {
|
||||
var tsBase = null;
|
||||
this.buffer.push(PsCodeConverter.openContent);
|
||||
this.addData(collection);
|
||||
this.buffer.push(PsCodeConverter.closeContent);
|
||||
};
|
||||
PsCodeConverter.prototype.jsonName = function (original) {
|
||||
// let name = original[0].toLowerCase() + original.substr(1);
|
||||
var name = original;
|
||||
name = this.replaceAll(name, '-', '_');
|
||||
name = name.substr(0, name.length - 4);
|
||||
return name;
|
||||
};
|
||||
PsCodeConverter.prototype.regexEscape = function (str) {
|
||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
};
|
||||
PsCodeConverter.prototype.replaceAll = function (input, searchValue, replaceValue) {
|
||||
return input.replace(new RegExp(this.regexEscape(searchValue), 'g'), replaceValue);
|
||||
};
|
||||
PsCodeConverter.prototype.addToContent = function (name, script, indent) {
|
||||
this.buffer.push(this.indent(indent) + 'export const ' + name + ': string = ' + script + ';\n');
|
||||
};
|
||||
PsCodeConverter.prototype.addData = function (current) {
|
||||
var keys = Object.keys(current);
|
||||
var _loop_1 = function (key) {
|
||||
var script = '';
|
||||
var content = current[key];
|
||||
var name_1 = this_1.jsonName(key);
|
||||
script = '##' + name_1 + '##:' + key + '\n';
|
||||
var removeComments = this_1.options.noComments;
|
||||
if (content.indexOf(PsCodeConverter.removeCommentsFalse) > 0) {
|
||||
removeComments = false;
|
||||
}
|
||||
else if (content.indexOf(PsCodeConverter.removeCommentsTrue) > 0) {
|
||||
removeComments = true;
|
||||
}
|
||||
var skipping = false;
|
||||
var lines = content.split('\r');
|
||||
lines.forEach(function (value, index, array) {
|
||||
var text = value.replace('\n', '');
|
||||
if (removeComments) {
|
||||
var process_1 = true;
|
||||
text = text.trim();
|
||||
if (text.startsWith(PsCodeConverter.commentStart)) {
|
||||
skipping = true;
|
||||
}
|
||||
if (skipping) {
|
||||
process_1 = false;
|
||||
if (text.endsWith(PsCodeConverter.commentEnd)) {
|
||||
skipping = false;
|
||||
}
|
||||
}
|
||||
if (process_1 && !text.startsWith(PsCodeConverter.comment) && text.length > 0) {
|
||||
script += text + '\n';
|
||||
}
|
||||
}
|
||||
else {
|
||||
script += text + '\n';
|
||||
}
|
||||
});
|
||||
var data = JSON.stringify(script);
|
||||
data = this_1.replaceAll(data, '\'', '\\u0027');
|
||||
data = this_1.replaceAll(data, '<', '\\u003c');
|
||||
data = this_1.replaceAll(data, '>', '\\u003e');
|
||||
data = this_1.replaceAll(data, '&', '\\u0026');
|
||||
this_1.addToContent(name_1, data, 1);
|
||||
};
|
||||
var this_1 = this;
|
||||
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
||||
var key = keys_1[_i];
|
||||
_loop_1(key);
|
||||
}
|
||||
};
|
||||
PsCodeConverter.prototype.indent = function (count) {
|
||||
var pad = '';
|
||||
for (var i = 0; i < count; i++) {
|
||||
pad += ' ';
|
||||
}
|
||||
return pad;
|
||||
};
|
||||
return PsCodeConverter;
|
||||
}());
|
||||
PsCodeConverter.removeCommentsTrue = '##RemoveComments=true##';
|
||||
PsCodeConverter.removeCommentsFalse = '##RemoveComments=false##';
|
||||
PsCodeConverter.commentStart = '<#';
|
||||
PsCodeConverter.commentEnd = '#>';
|
||||
PsCodeConverter.comment = '#';
|
||||
PsCodeConverter.openContent = "/* tslint:disable */\n/**\n * @file Source code generated by gulp-ps-code.\n * @version 1.0\n */\nexport module PowerShellScripts {\n 'use strict'\n";
|
||||
PsCodeConverter.closeContent = "}\n";
|
||||
exports.PsCodeConverter = PsCodeConverter;
|
|
@ -1,128 +0,0 @@
|
|||
declare function escape(data: string): string;
|
||||
declare function unescape(data: string): string;
|
||||
|
||||
export interface Options {
|
||||
noComments: boolean;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export class PsCodeConverter {
|
||||
private static removeCommentsTrue = '##RemoveComments=true##';
|
||||
private static removeCommentsFalse = '##RemoveComments=false##';
|
||||
private static commentStart = '<#';
|
||||
private static commentEnd = '#>';
|
||||
private static comment = '#';
|
||||
private static openContent =
|
||||
`/* tslint:disable */
|
||||
/**
|
||||
* @file Source code generated by gulp-ps-code.
|
||||
* @version 1.0
|
||||
*/
|
||||
export module PowerShellScripts {
|
||||
'use strict'
|
||||
`;
|
||||
private static closeContent =
|
||||
`}
|
||||
`;
|
||||
private buffer: string[];
|
||||
|
||||
constructor(private options?: Options) {
|
||||
this.options = options ? options : { noComments: true, name: 'powershell-scripts.ts' };
|
||||
if (!this.options.hasOwnProperty('noComments')) {
|
||||
this.options.noComments = true;
|
||||
}
|
||||
}
|
||||
|
||||
public get content(): string {
|
||||
return this.buffer.join('');
|
||||
}
|
||||
|
||||
public contentReset(): void {
|
||||
this.buffer = [];
|
||||
}
|
||||
|
||||
public generate(collection: { [index: string]: string }): void {
|
||||
let tsBase = null;
|
||||
this.buffer.push(PsCodeConverter.openContent);
|
||||
this.addData(collection);
|
||||
this.buffer.push(PsCodeConverter.closeContent);
|
||||
}
|
||||
|
||||
private jsonName (original: string): string {
|
||||
// let name = original[0].toLowerCase() + original.substr(1);
|
||||
let name = original;
|
||||
name = this.replaceAll(name, '-', '_');
|
||||
name = name.substr(0, name.length - 4);
|
||||
return name;
|
||||
}
|
||||
|
||||
private regexEscape(str: string): string {
|
||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
}
|
||||
|
||||
private replaceAll(input: string, searchValue: string, replaceValue: string): string {
|
||||
return input.replace(new RegExp(this.regexEscape(searchValue), 'g'), replaceValue);
|
||||
}
|
||||
|
||||
private addToContent(name: string, script: string, indent: number): void {
|
||||
this.buffer.push(this.indent(indent) + 'export const ' + name + ': string = ' + script + ';\n');
|
||||
}
|
||||
|
||||
private addData(current: { [index: string]: string }): void {
|
||||
let keys = Object.keys(current);
|
||||
for (let key of keys) {
|
||||
let script = '';
|
||||
let content: string = current[key];
|
||||
let name = this.jsonName(key);
|
||||
script = '##' + name + '##:' + key + '\n';
|
||||
let removeComments = this.options.noComments;
|
||||
if (content.indexOf(PsCodeConverter.removeCommentsFalse) > 0) {
|
||||
removeComments = false;
|
||||
} else if (content.indexOf(PsCodeConverter.removeCommentsTrue) > 0) {
|
||||
removeComments = true;
|
||||
}
|
||||
|
||||
let skipping = false;
|
||||
let lines = content.split('\r');
|
||||
lines.forEach((value, index, array) => {
|
||||
let text = value.replace('\n', '');
|
||||
if (removeComments) {
|
||||
let process = true;
|
||||
text = text.trim();
|
||||
if (text.startsWith(PsCodeConverter.commentStart)) {
|
||||
skipping = true;
|
||||
}
|
||||
|
||||
if (skipping) {
|
||||
process = false;
|
||||
if (text.endsWith(PsCodeConverter.commentEnd)) {
|
||||
skipping = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (process && !text.startsWith(PsCodeConverter.comment) && text.length > 0) {
|
||||
script += text + '\n';
|
||||
}
|
||||
} else {
|
||||
script += text + '\n';
|
||||
}
|
||||
|
||||
});
|
||||
let data = JSON.stringify(script);
|
||||
data = this.replaceAll(data, '\'', '\\u0027');
|
||||
data = this.replaceAll(data, '<', '\\u003c');
|
||||
data = this.replaceAll(data, '>', '\\u003e');
|
||||
data = this.replaceAll(data, '&', '\\u0026');
|
||||
this.addToContent(name, data, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private indent(count: number): string {
|
||||
let pad = '';
|
||||
for (let i = 0; i < count; i++) {
|
||||
pad += ' ';
|
||||
}
|
||||
|
||||
return pad;
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
exports.__esModule = true;
|
||||
var through2 = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var Path = require("path");
|
||||
var Resjson = require("./resjson-convert");
|
||||
var Vinyl = require("vinyl");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-resjson';
|
||||
function gulpResjson(options) {
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// enable to produce xxxx.d.ts file.
|
||||
// definition: string; { null, 'module' }
|
||||
//
|
||||
// enable to produce xxxx.ts file.
|
||||
// typescript: string; { null, 'module', 'interface' }
|
||||
//
|
||||
// enable to produce xxxx.json file.
|
||||
// json: boolean;
|
||||
//
|
||||
// if set a space charactors, it adds formating of JSON.
|
||||
// it set null, space will be eliminated.
|
||||
// jsonSpace: string | number;
|
||||
//
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({ definition: null, typescript: null, json: false, jsonSpace: null }, options || {});
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
return pError;
|
||||
}
|
||||
return through2.obj(
|
||||
/**
|
||||
* @this {Transform}
|
||||
*/
|
||||
function (file, encoding, callback) {
|
||||
var error = null;
|
||||
try {
|
||||
if (file.isNull()) {
|
||||
// nothing to do
|
||||
return callback(null, file);
|
||||
}
|
||||
if (file.isStream()) {
|
||||
// file.contents is a Stream - https://nodejs.org/api/stream.html
|
||||
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'));
|
||||
return callback(null, file);
|
||||
}
|
||||
else if (file.isBuffer()) {
|
||||
var data = file.contents.toString('utf8');
|
||||
var converter = new Resjson.ResJsonConverter(options);
|
||||
converter.convert(data);
|
||||
var path = Path.parse(file.path);
|
||||
if (options.definition) {
|
||||
var dtFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: path.dir,
|
||||
path: path.dir + '/' + path.name + '.d.ts',
|
||||
contents: new Buffer(converter.contentDefinition)
|
||||
});
|
||||
this.push(dtFile);
|
||||
}
|
||||
if (options.typescript) {
|
||||
var content = options.typescript === 'interface' ? converter.contentInterface : converter.contentTypescript;
|
||||
var tsFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: path.dir,
|
||||
path: path.dir + '/' + path.name + '.ts',
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
this.push(tsFile);
|
||||
}
|
||||
if (options.json) {
|
||||
var base = options.srcRoot || path.dir;
|
||||
var content = JSON.stringify(converter.outputJson, null, options.jsonSpace);
|
||||
var jsonFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: base,
|
||||
path: path.dir + '\\' + path.name + '.json',
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
this.push(jsonFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
callback(error);
|
||||
});
|
||||
}
|
||||
;
|
||||
module.exports = gulpResjson;
|
|
@ -1,108 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
import through2 = require('through2');
|
||||
import gutil = require('gulp-util');
|
||||
import Path = require('path');
|
||||
import Resjson = require('./resjson-convert');
|
||||
import Vinyl = require('vinyl');
|
||||
|
||||
let PluginError = gutil.PluginError;
|
||||
let PLUGIN_NAME = 'gulp-resjson';
|
||||
|
||||
function gulpResjson(options) {
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// enable to produce xxxx.d.ts file.
|
||||
// definition: string; { null, 'module' }
|
||||
//
|
||||
// enable to produce xxxx.ts file.
|
||||
// typescript: string; { null, 'module', 'interface' }
|
||||
//
|
||||
// enable to produce xxxx.json file.
|
||||
// json: boolean;
|
||||
//
|
||||
// if set a space charactors, it adds formating of JSON.
|
||||
// it set null, space will be eliminated.
|
||||
// jsonSpace: string | number;
|
||||
//
|
||||
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({ definition: null, typescript: null, json: false, jsonSpace: null }, options || {});
|
||||
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
|
||||
return pError;
|
||||
}
|
||||
|
||||
return through2.obj(
|
||||
/**
|
||||
* @this {Transform}
|
||||
*/
|
||||
function (file, encoding, callback) {
|
||||
let error = null;
|
||||
try {
|
||||
if (file.isNull()) {
|
||||
// nothing to do
|
||||
return callback(null, file);
|
||||
}
|
||||
|
||||
if (file.isStream()) {
|
||||
// file.contents is a Stream - https://nodejs.org/api/stream.html
|
||||
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'));
|
||||
return callback(null, file);
|
||||
} else if (file.isBuffer()) {
|
||||
let data = file.contents.toString('utf8');
|
||||
let converter = new Resjson.ResJsonConverter(options);
|
||||
converter.convert(data);
|
||||
|
||||
let path = Path.parse(file.path);
|
||||
if (options.definition) {
|
||||
let dtFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: path.dir,
|
||||
path: path.dir + '/' + path.name + '.d.ts',
|
||||
contents: new Buffer(converter.contentDefinition)
|
||||
});
|
||||
this.push(dtFile);
|
||||
}
|
||||
|
||||
if (options.typescript) {
|
||||
let content = options.typescript === 'interface' ? converter.contentInterface : converter.contentTypescript;
|
||||
let tsFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: path.dir,
|
||||
path: path.dir + '/' + path.name + '.ts',
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
this.push(tsFile);
|
||||
}
|
||||
|
||||
if (options.json) {
|
||||
let base = options.srcRoot || path.dir;
|
||||
let content = JSON.stringify(converter.outputJson, null, options.jsonSpace);
|
||||
let jsonFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: base,
|
||||
path: path.dir + '\\' + path.name + '.json',
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
this.push(jsonFile);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
|
||||
callback(error);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = gulpResjson
|
|
@ -1,146 +0,0 @@
|
|||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var ResJsonConverter = (function () {
|
||||
function ResJsonConverter(options) {
|
||||
this.options = options;
|
||||
}
|
||||
Object.defineProperty(ResJsonConverter.prototype, "contentDefinition", {
|
||||
get: function () {
|
||||
return this.outputDefinition.join('');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ResJsonConverter.prototype, "contentTypescript", {
|
||||
get: function () {
|
||||
return this.outputTypescript.join('');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ResJsonConverter.prototype, "contentInterface", {
|
||||
get: function () {
|
||||
return this.outputInterface.join('');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
ResJsonConverter.prototype.contentReset = function () {
|
||||
this.outputDefinition = [];
|
||||
this.outputTypescript = [];
|
||||
this.outputInterface = [];
|
||||
this.outputJson = {};
|
||||
this.jsonCurrent = this.outputJson;
|
||||
};
|
||||
ResJsonConverter.prototype.convert = function (content) {
|
||||
var root = {};
|
||||
// Remove comments, /* multilinecomment*/ and // one line comment and "//": "JSON element comment"
|
||||
content = content.replace(/(\/\*([^*]|[\n]|(\*+([^*/]|[\n])))*\*\/+)|( +\/\/.*)|( +\"\/\/\".*)/g, '');
|
||||
var data = JSON.parse(content);
|
||||
var itemKeys = Object.keys(data);
|
||||
// build a data tree.
|
||||
for (var _i = 0, itemKeys_1 = itemKeys; _i < itemKeys_1.length; _i++) {
|
||||
var itemKey = itemKeys_1[_i];
|
||||
// remove localization comments
|
||||
if (itemKey.startsWith('//') || (itemKey.startsWith('_') && itemKey.endsWith('.comment'))) {
|
||||
continue;
|
||||
}
|
||||
var current = root;
|
||||
var itemValue = data[itemKey];
|
||||
var keys = itemKey.split('_');
|
||||
var count = keys.length;
|
||||
for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) {
|
||||
var key = keys_1[_a];
|
||||
count--;
|
||||
if (count > 0) {
|
||||
if (!current.hasOwnProperty(key)) {
|
||||
current[key] = {};
|
||||
}
|
||||
current = current[key];
|
||||
if (typeof current !== 'object') {
|
||||
throw new Error('Resource key already exists: ' + itemKey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
current[key] = itemValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.contentReset();
|
||||
this.traverse([{ name: 'Strings', value: root }], 0);
|
||||
};
|
||||
ResJsonConverter.prototype.jsonNewValue = function (name) {
|
||||
var old = this.jsonCurrent;
|
||||
var json = {};
|
||||
this.jsonCurrent[name] = json;
|
||||
this.jsonCurrent = json;
|
||||
return old;
|
||||
};
|
||||
ResJsonConverter.prototype.jsonAddValue = function (name, value) {
|
||||
this.jsonCurrent[name] = value;
|
||||
};
|
||||
ResJsonConverter.prototype.scan = function (node) {
|
||||
var current = node;
|
||||
var keyItems = [];
|
||||
var dataItems = [];
|
||||
for (var itemKey in current) {
|
||||
if (current.hasOwnProperty(itemKey)) {
|
||||
var itemValue = current[itemKey];
|
||||
if (typeof itemValue === 'object') {
|
||||
keyItems.push({ name: itemKey, value: itemValue });
|
||||
}
|
||||
else if (typeof itemValue === 'string') {
|
||||
dataItems.push({ name: itemKey, value: itemValue });
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyItems: keyItems,
|
||||
dataItems: dataItems
|
||||
};
|
||||
};
|
||||
ResJsonConverter.prototype.traverse = function (keyItems, indent) {
|
||||
var indentSpace = ' ';
|
||||
var indentName = '';
|
||||
for (var i = 0; i < indent; i++) {
|
||||
indentName += indentSpace;
|
||||
}
|
||||
var indentValue = indentName + indentSpace;
|
||||
if (keyItems.length > 0) {
|
||||
for (var _i = 0, keyItems_1 = keyItems; _i < keyItems_1.length; _i++) {
|
||||
var item = keyItems_1[_i];
|
||||
if (indent === 0) {
|
||||
this.outputDefinition.push(ResJsonConverter.openContent);
|
||||
this.outputTypescript.push(ResJsonConverter.openContent);
|
||||
this.outputInterface.push(ResJsonConverter.openContent);
|
||||
this.outputDefinition.push('export declare module ' + item.name + ' {\r\n');
|
||||
this.outputTypescript.push('export module ' + item.name + ' {\r\n \'use strict\';\r\n');
|
||||
this.outputInterface.push('export interface ' + item.name + ' {\r\n');
|
||||
}
|
||||
else {
|
||||
this.outputDefinition.push(indentName + 'module ' + item.name + ' {\r\n');
|
||||
this.outputTypescript.push(indentName + 'export module ' + item.name + ' {\r\n');
|
||||
this.outputInterface.push(indentName + item.name + ': {\r\n');
|
||||
}
|
||||
var jsonOld = this.jsonNewValue(item.name);
|
||||
var results = this.scan(item.value);
|
||||
for (var _a = 0, _b = results.dataItems; _a < _b.length; _a++) {
|
||||
var item2 = _b[_a];
|
||||
this.outputDefinition.push(indentValue + 'const ' + item2.name + ': string;\r\n');
|
||||
this.outputTypescript.push(indentValue + 'export const ' + item2.name + ' = \'' + item2.value + '\';\r\n');
|
||||
this.outputInterface.push(indentValue + item2.name + ': string;\r\n');
|
||||
this.jsonAddValue(item2.name, item2.value);
|
||||
}
|
||||
this.traverse(results.keyItems, ++indent);
|
||||
this.jsonCurrent = jsonOld;
|
||||
this.outputDefinition.push(indentName + '}\r\n');
|
||||
this.outputTypescript.push(indentName + '}\r\n');
|
||||
this.outputInterface.push(indentName + '};\r\n');
|
||||
}
|
||||
}
|
||||
};
|
||||
return ResJsonConverter;
|
||||
}());
|
||||
ResJsonConverter.openContent = "/* tslint:disable */\n/**\n * @file Source code generated by gulp-resjson.\n * @version 1.0\n */\n";
|
||||
ResJsonConverter.closeContent = "}\n";
|
||||
exports.ResJsonConverter = ResJsonConverter;
|
|
@ -1,178 +0,0 @@
|
|||
export interface Options {
|
||||
// enable to produce xxxx.d.ts file.
|
||||
// { null, 'module' }
|
||||
definition: string;
|
||||
|
||||
// enable to produce xxxx.ts file.
|
||||
// { null, 'module', 'interface' }
|
||||
typescript: string;
|
||||
|
||||
// enable to produce xxxx.json file.
|
||||
json: boolean;
|
||||
|
||||
// if set a space characters, it adds formating of JSON.
|
||||
// it set null, space will be eliminated.
|
||||
jsonSpace: string | number;
|
||||
}
|
||||
|
||||
interface NameValuePair {
|
||||
name: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
export class ResJsonConverter {
|
||||
private static openContent =
|
||||
`/* tslint:disable */
|
||||
/**
|
||||
* @file Source code generated by gulp-resjson.
|
||||
* @version 1.0
|
||||
*/
|
||||
`;
|
||||
private static closeContent =
|
||||
`}
|
||||
`;
|
||||
public outputJson: any;
|
||||
private outputDefinition: string[];
|
||||
private outputTypescript: string[];
|
||||
private outputInterface: string[];
|
||||
private jsonCurrent: any;
|
||||
|
||||
constructor(private options: Options) {
|
||||
}
|
||||
|
||||
public get contentDefinition(): string {
|
||||
return this.outputDefinition.join('');
|
||||
}
|
||||
|
||||
public get contentTypescript(): string {
|
||||
return this.outputTypescript.join('');
|
||||
}
|
||||
|
||||
public get contentInterface(): string {
|
||||
return this.outputInterface.join('');
|
||||
}
|
||||
|
||||
public contentReset(): void {
|
||||
this.outputDefinition = [];
|
||||
this.outputTypescript = [];
|
||||
this.outputInterface = [];
|
||||
this.outputJson = {};
|
||||
this.jsonCurrent = this.outputJson;
|
||||
}
|
||||
|
||||
public convert(content: string) {
|
||||
let root = {};
|
||||
// Remove comments, /* multilinecomment*/ and // one line comment and "//": "JSON element comment"
|
||||
content = content.replace(/(\/\*([^*]|[\n]|(\*+([^*/]|[\n])))*\*\/+)|( +\/\/.*)|( +\"\/\/\".*)/g, '');
|
||||
let data: any = JSON.parse(content);
|
||||
let itemKeys = Object.keys(data);
|
||||
|
||||
// build a data tree.
|
||||
for (let itemKey of itemKeys) {
|
||||
// remove localization comments
|
||||
if (itemKey.startsWith('//') || (itemKey.startsWith('_') && itemKey.endsWith('.comment'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let current = root;
|
||||
let itemValue = data[itemKey];
|
||||
const keys = itemKey.split('_');
|
||||
let count = keys.length;
|
||||
for (let key of keys) {
|
||||
count--;
|
||||
if (count > 0) {
|
||||
if (!current.hasOwnProperty(key)) {
|
||||
current[key] = {};
|
||||
}
|
||||
|
||||
current = current[key];
|
||||
|
||||
if (typeof current !== 'object') {
|
||||
throw new Error('Resource key already exists: ' + itemKey);
|
||||
}
|
||||
} else {
|
||||
current[key] = itemValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.contentReset();
|
||||
this.traverse([{ name: 'Strings', value: root }], 0);
|
||||
}
|
||||
|
||||
private jsonNewValue(name: string): any {
|
||||
let old = this.jsonCurrent;
|
||||
let json = {};
|
||||
this.jsonCurrent[name] = json;
|
||||
this.jsonCurrent = json;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
private jsonAddValue(name: string, value: any): void {
|
||||
this.jsonCurrent[name] = value;
|
||||
}
|
||||
|
||||
private scan(node: any): { keyItems: NameValuePair[], dataItems: NameValuePair[] } {
|
||||
let current = node;
|
||||
let keyItems: NameValuePair[] = [];
|
||||
let dataItems: NameValuePair[] = [];
|
||||
for (let itemKey in current) {
|
||||
if (current.hasOwnProperty(itemKey)) {
|
||||
let itemValue: any = current[itemKey];
|
||||
if (typeof itemValue === 'object') {
|
||||
keyItems.push({ name: itemKey, value: itemValue });
|
||||
} else if (typeof itemValue === 'string') {
|
||||
dataItems.push({ name: itemKey, value: itemValue });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
keyItems: keyItems,
|
||||
dataItems: dataItems
|
||||
};
|
||||
}
|
||||
|
||||
private traverse(keyItems: NameValuePair[], indent: number): void {
|
||||
const indentSpace = ' ';
|
||||
let indentName = '';
|
||||
for (let i = 0; i < indent; i++) {
|
||||
indentName += indentSpace;
|
||||
}
|
||||
|
||||
let indentValue: string = indentName + indentSpace;
|
||||
if (keyItems.length > 0) {
|
||||
for (let item of keyItems) {
|
||||
if (indent === 0) {
|
||||
this.outputDefinition.push(ResJsonConverter.openContent);
|
||||
this.outputTypescript.push(ResJsonConverter.openContent);
|
||||
this.outputInterface.push(ResJsonConverter.openContent);
|
||||
this.outputDefinition.push('export declare module ' + item.name + ' {\r\n');
|
||||
this.outputTypescript.push('export module ' + item.name + ' {\r\n \'use strict\';\r\n');
|
||||
this.outputInterface.push('export interface ' + item.name + ' {\r\n');
|
||||
} else {
|
||||
this.outputDefinition.push(indentName + 'module ' + item.name + ' {\r\n');
|
||||
this.outputTypescript.push(indentName + 'export module ' + item.name + ' {\r\n');
|
||||
this.outputInterface.push(indentName + item.name + ': {\r\n');
|
||||
}
|
||||
|
||||
let jsonOld = this.jsonNewValue(item.name);
|
||||
let results = this.scan(item.value);
|
||||
for (let item2 of results.dataItems) {
|
||||
this.outputDefinition.push(indentValue + 'const ' + item2.name + ': string;\r\n');
|
||||
this.outputTypescript.push(indentValue + 'export const ' + item2.name + ' = \'' + item2.value + '\';\r\n');
|
||||
this.outputInterface.push(indentValue + item2.name + ': string;\r\n');
|
||||
this.jsonAddValue(item2.name, item2.value);
|
||||
}
|
||||
|
||||
this.traverse(results.keyItems, ++indent);
|
||||
this.jsonCurrent = jsonOld;
|
||||
|
||||
this.outputDefinition.push(indentName + '}\r\n');
|
||||
this.outputTypescript.push(indentName + '}\r\n');
|
||||
this.outputInterface.push(indentName + '};\r\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
exports.__esModule = true;
|
||||
var through2 = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var Path = require("path");
|
||||
var Vinyl = require("vinyl");
|
||||
var SvgCode = require("./svg-code-convert");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-svg-code';
|
||||
/**
|
||||
* Plugin level function
|
||||
*/
|
||||
function gulpSvgCode() {
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
return pError;
|
||||
}
|
||||
var pathPrefix = null;
|
||||
var collection = {};
|
||||
return through2.obj(function (file, enc, cb) {
|
||||
var error = null;
|
||||
try {
|
||||
var path = Path.parse(file.path);
|
||||
if (path.ext === '.svg') {
|
||||
if (pathPrefix === null) {
|
||||
pathPrefix = path.dir;
|
||||
}
|
||||
else {
|
||||
var segments = path.dir.split('\\');
|
||||
var segPrefix = pathPrefix.split('\\');
|
||||
var newPrefix = [];
|
||||
for (var i = 0; i < segPrefix.length; i++) {
|
||||
if (segments[i].toLocaleUpperCase() !== segPrefix[i].toLocaleUpperCase()) {
|
||||
pathPrefix = newPrefix.join('\\');
|
||||
break;
|
||||
}
|
||||
newPrefix.push(segments[i]);
|
||||
}
|
||||
}
|
||||
var data = file.contents.toString('utf8');
|
||||
collection[file.path] = data;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
return cb(error);
|
||||
}, function (cb) {
|
||||
var converter = new SvgCode.SvgCodeConverter();
|
||||
converter.contentReset();
|
||||
converter.generate(collection, pathPrefix);
|
||||
var cssFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: pathPrefix,
|
||||
path: pathPrefix + '\\svg.css',
|
||||
contents: new Buffer(converter.contentCss)
|
||||
});
|
||||
this.push(cssFile);
|
||||
var tsFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: pathPrefix,
|
||||
path: pathPrefix + '\\svg.ts',
|
||||
contents: new Buffer(converter.contentTs)
|
||||
});
|
||||
this.push(tsFile);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
module.exports = gulpSvgCode;
|
|
@ -1,88 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
|
||||
import through2 = require('through2');
|
||||
import gutil = require('gulp-util');
|
||||
import Path = require('path');
|
||||
import Vinyl = require('vinyl');
|
||||
import SvgCode = require('./svg-code-convert');
|
||||
|
||||
let PluginError = gutil.PluginError;
|
||||
let PLUGIN_NAME = 'gulp-svg-code';
|
||||
|
||||
/**
|
||||
* Plugin level function
|
||||
*/
|
||||
function gulpSvgCode() {
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(
|
||||
function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
},
|
||||
pError);
|
||||
}
|
||||
|
||||
return pError;
|
||||
}
|
||||
|
||||
let pathPrefix = null;
|
||||
let collection = {};
|
||||
return through2.obj(
|
||||
function (file, enc, cb) {
|
||||
let error = null;
|
||||
try {
|
||||
let path = Path.parse(file.path);
|
||||
if (path.ext === '.svg') {
|
||||
if (pathPrefix === null) {
|
||||
pathPrefix = path.dir;
|
||||
} else {
|
||||
let segments = path.dir.split('\\');
|
||||
let segPrefix = pathPrefix.split('\\');
|
||||
let newPrefix = [];
|
||||
for (let i = 0; i < segPrefix.length; i++) {
|
||||
if (segments[i].toLocaleUpperCase() !== segPrefix[i].toLocaleUpperCase()) {
|
||||
pathPrefix = newPrefix.join('\\');
|
||||
break;
|
||||
}
|
||||
|
||||
newPrefix.push(segments[i]);
|
||||
}
|
||||
}
|
||||
|
||||
let data = file.contents.toString('utf8');
|
||||
collection[file.path] = data;
|
||||
}
|
||||
} catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
|
||||
return cb(error);
|
||||
},
|
||||
function (cb) {
|
||||
let converter = new SvgCode.SvgCodeConverter();
|
||||
converter.contentReset();
|
||||
converter.generate(collection, pathPrefix);
|
||||
|
||||
let cssFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: pathPrefix,
|
||||
path: pathPrefix + '\\svg.css',
|
||||
contents: new Buffer(converter.contentCss)
|
||||
});
|
||||
this.push(cssFile);
|
||||
|
||||
let tsFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: pathPrefix,
|
||||
path: pathPrefix + '\\svg.ts',
|
||||
contents: new Buffer(converter.contentTs)
|
||||
});
|
||||
this.push(tsFile);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = gulpSvgCode;
|
|
@ -1,138 +0,0 @@
|
|||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var SvgCodeConverter = (function () {
|
||||
function SvgCodeConverter() {
|
||||
this.outputCss = [];
|
||||
this.outputTs = [];
|
||||
}
|
||||
Object.defineProperty(SvgCodeConverter.prototype, "contentCss", {
|
||||
get: function () {
|
||||
return this.outputCss.join('');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(SvgCodeConverter.prototype, "contentTs", {
|
||||
get: function () {
|
||||
return this.outputTs.join('');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
SvgCodeConverter.prototype.contentReset = function () {
|
||||
this.outputCss = [];
|
||||
this.outputTs = [];
|
||||
};
|
||||
SvgCodeConverter.prototype.generate = function (collection, pathPrefix) {
|
||||
var root = this.createStructure(collection, pathPrefix);
|
||||
this.outputCss.push(SvgCodeConverter.openContentCss);
|
||||
this.outputTs.push(SvgCodeConverter.openContentTs);
|
||||
this.addData(root, []);
|
||||
this.outputTs.push(SvgCodeConverter.closeContentTs);
|
||||
};
|
||||
SvgCodeConverter.prototype.addData = function (current, segments) {
|
||||
var _this = this;
|
||||
var ignores = ['<?xml', '<!-- Generator:', '<!DOCTYPE'];
|
||||
var nested = [];
|
||||
var keys = Object.keys(current);
|
||||
var _loop_1 = function (key) {
|
||||
var content = current[key];
|
||||
segments.push(key);
|
||||
if (typeof content === 'object') {
|
||||
var segs = segments.slice(0);
|
||||
nested.push({ content: content, segs: segs });
|
||||
}
|
||||
else if (typeof content === 'string') {
|
||||
var cssName = '.svg-' + segments.join('--');
|
||||
this_1.outputCss.push(cssName + ' {\r\n');
|
||||
this_1.outputCss.push(this_1.indent(1) + 'background-image: url("data:image/svg+xml;');
|
||||
this_1.outputTs.push(this_1.indent(segments.length) + 'export const ' + key + ' = \'');
|
||||
var lines = content.split('\r');
|
||||
var svg_1 = '';
|
||||
lines.forEach(function (value, index, array) {
|
||||
value = value.replace('\n', '');
|
||||
if (value && value.length > 1) {
|
||||
var skip = false;
|
||||
for (var _i = 0, ignores_1 = ignores; _i < ignores_1.length; _i++) {
|
||||
var item = ignores_1[_i];
|
||||
if (value.indexOf(item) >= 0) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!skip) {
|
||||
svg_1 += value;
|
||||
// this.outputCss.push(value);
|
||||
_this.outputTs.push(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
svg_1 = this_1.replaceAll(svg_1, '"', '\'');
|
||||
svg_1 = this_1.replaceAll(svg_1, '%', '%25');
|
||||
svg_1 = this_1.replaceAll(svg_1, '#', '%23');
|
||||
svg_1 = this_1.replaceAll(svg_1, '{', '%7B');
|
||||
svg_1 = this_1.replaceAll(svg_1, '}', '%7D');
|
||||
svg_1 = this_1.replaceAll(svg_1, '<', '%3C');
|
||||
svg_1 = this_1.replaceAll(svg_1, '>', '%3E');
|
||||
this_1.outputCss.push('charset=utf8,' + svg_1);
|
||||
this_1.outputCss.push('");\r\n');
|
||||
this_1.outputCss.push('}\r\n');
|
||||
this_1.outputCss.push('\r\n');
|
||||
this_1.outputTs.push('\';\r\n');
|
||||
}
|
||||
segments.pop();
|
||||
};
|
||||
var this_1 = this;
|
||||
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
||||
var key = keys_1[_i];
|
||||
_loop_1(key);
|
||||
}
|
||||
for (var index = 0; index < nested.length; index++) {
|
||||
var _a = nested[index], content = _a.content, segs = _a.segs;
|
||||
this.outputTs.push(this.indent(segs.length) + 'export module ' + segs[segs.length - 1] + ' {\r\n');
|
||||
this.addData(nested[index].content, nested[index].segs);
|
||||
this.outputTs.push(this.indent(segs.length) + '}\r\n');
|
||||
}
|
||||
};
|
||||
SvgCodeConverter.prototype.createStructure = function (collection, pathPrefix) {
|
||||
var root = {};
|
||||
var keys = Object.keys(collection).sort(function (left, right) { return left.toLowerCase().localeCompare(right.toLowerCase()); });
|
||||
for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
|
||||
var key = keys_2[_i];
|
||||
var shortName = key.substr(0, key.length - '.svg'.length);
|
||||
shortName = this.replaceAll(shortName.substr(pathPrefix.length + 1), '-', '_').toLowerCase();
|
||||
var segments = shortName.split('\\');
|
||||
var current = root;
|
||||
for (var index = 0; index < segments.length - 1; index++) {
|
||||
var segment = segments[index];
|
||||
if (current.hasOwnProperty(segment)) {
|
||||
current = current[segment];
|
||||
}
|
||||
else {
|
||||
current[segment] = {};
|
||||
current = current[segment];
|
||||
}
|
||||
}
|
||||
current[segments[segments.length - 1]] = collection[key];
|
||||
}
|
||||
return root;
|
||||
};
|
||||
SvgCodeConverter.prototype.regexEscape = function (str) {
|
||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
};
|
||||
SvgCodeConverter.prototype.replaceAll = function (input, searchValue, replaceValue) {
|
||||
return input.replace(new RegExp(this.regexEscape(searchValue), 'g'), replaceValue);
|
||||
};
|
||||
SvgCodeConverter.prototype.indent = function (count) {
|
||||
var pad = '';
|
||||
for (var i = 0; i < count; i++) {
|
||||
pad += ' ';
|
||||
}
|
||||
return pad;
|
||||
};
|
||||
return SvgCodeConverter;
|
||||
}());
|
||||
SvgCodeConverter.openContentTs = "/* tslint:disable */\n/**\n * @file Source code generated by gulp-svg-code.\n * @version 1.0\n */\nexport module Svg {\n 'use strict'\n";
|
||||
SvgCodeConverter.closeContentTs = "}\n";
|
||||
SvgCodeConverter.openContentCss = "/**\n * @file Source code generated by gulp-svg-code.\n * @version 1.0\n */\n";
|
||||
exports.SvgCodeConverter = SvgCodeConverter;
|
|
@ -1,153 +0,0 @@
|
|||
declare function escape(data: string): string;
|
||||
declare function unescape(data: string): string;
|
||||
|
||||
export class SvgCodeConverter {
|
||||
private static openContentTs =
|
||||
`/* tslint:disable */
|
||||
/**
|
||||
* @file Source code generated by gulp-svg-code.
|
||||
* @version 1.0
|
||||
*/
|
||||
export module Svg {
|
||||
'use strict'
|
||||
`;
|
||||
private static closeContentTs =
|
||||
`}
|
||||
`;
|
||||
private static openContentCss =
|
||||
`/**
|
||||
* @file Source code generated by gulp-svg-code.
|
||||
* @version 1.0
|
||||
*/
|
||||
`;
|
||||
private outputCss: string[] = [];
|
||||
private outputTs: string[] = [];
|
||||
|
||||
public get contentCss(): string {
|
||||
return this.outputCss.join('');
|
||||
}
|
||||
|
||||
public get contentTs(): string {
|
||||
return this.outputTs.join('');
|
||||
}
|
||||
|
||||
public contentReset(): void {
|
||||
this.outputCss = [];
|
||||
this.outputTs = [];
|
||||
}
|
||||
|
||||
public generate(collection: { [index: string]: any }, pathPrefix: string): void {
|
||||
let root = this.createStructure(collection, pathPrefix);
|
||||
this.outputCss.push(SvgCodeConverter.openContentCss);
|
||||
this.outputTs.push(SvgCodeConverter.openContentTs);
|
||||
this.addData(root, []);
|
||||
this.outputTs.push(SvgCodeConverter.closeContentTs);
|
||||
}
|
||||
|
||||
private addData(current: any, segments: string[]): void {
|
||||
const ignores = [ '<?xml', '<!-- Generator:', '<!DOCTYPE' ];
|
||||
let nested: any[] = [];
|
||||
let keys = Object.keys(current);
|
||||
for (let key of keys) {
|
||||
let content = current[key];
|
||||
segments.push(key);
|
||||
|
||||
if (typeof content === 'object') {
|
||||
let segs = segments.slice(0);
|
||||
nested.push({ content, segs });
|
||||
} else if (typeof content === 'string') {
|
||||
let cssName = '.svg-' + segments.join('--');
|
||||
this.outputCss.push(cssName + ' {\r\n');
|
||||
this.outputCss.push(this.indent(1) + 'background-image: url("data:image/svg+xml;');
|
||||
|
||||
this.outputTs.push(this.indent(segments.length) + 'export const ' + key + ' = \'');
|
||||
|
||||
let lines = content.split('\r');
|
||||
let svg = '';
|
||||
lines.forEach((value, index, array) => {
|
||||
value = value.replace('\n', '');
|
||||
if (value && value.length > 1) {
|
||||
let skip = false;
|
||||
for (let item of ignores) {
|
||||
if (value.indexOf(item) >= 0) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
svg += value;
|
||||
// this.outputCss.push(value);
|
||||
this.outputTs.push(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
svg = this.replaceAll(svg, '"', '\'');
|
||||
svg = this.replaceAll(svg, '%', '%25');
|
||||
svg = this.replaceAll(svg, '#', '%23');
|
||||
svg = this.replaceAll(svg, '{', '%7B');
|
||||
svg = this.replaceAll(svg, '}', '%7D');
|
||||
svg = this.replaceAll(svg, '<', '%3C');
|
||||
svg = this.replaceAll(svg, '>', '%3E');
|
||||
this.outputCss.push('charset=utf8,' + svg);
|
||||
|
||||
this.outputCss.push('");\r\n');
|
||||
this.outputCss.push('}\r\n');
|
||||
this.outputCss.push('\r\n');
|
||||
|
||||
this.outputTs.push('\';\r\n');
|
||||
}
|
||||
|
||||
segments.pop();
|
||||
}
|
||||
|
||||
for (let index = 0; index < nested.length; index++) {
|
||||
let { content, segs } = nested[index];
|
||||
this.outputTs.push(this.indent(segs.length) + 'export module ' + segs[segs.length - 1] + ' {\r\n');
|
||||
this.addData(nested[index].content, nested[index].segs);
|
||||
this.outputTs.push(this.indent(segs.length) + '}\r\n');
|
||||
}
|
||||
}
|
||||
|
||||
private createStructure(collection: { [index: string]: any }, pathPrefix: string): any {
|
||||
let root = {};
|
||||
let keys = Object.keys(collection).sort((left, right) => left.toLowerCase().localeCompare(right.toLowerCase()));
|
||||
for (let key of keys) {
|
||||
let shortName = key.substr(0, key.length - '.svg'.length);
|
||||
shortName = this.replaceAll(shortName.substr(pathPrefix.length + 1), '-', '_').toLowerCase();
|
||||
let segments = shortName.split('\\');
|
||||
let current = root;
|
||||
for (let index = 0; index < segments.length - 1; index++) {
|
||||
let segment = segments[index];
|
||||
if (current.hasOwnProperty(segment)) {
|
||||
current = current[segment];
|
||||
} else {
|
||||
current[segment] = {};
|
||||
current = current[segment];
|
||||
}
|
||||
}
|
||||
|
||||
current[segments[segments.length - 1]] = collection[key];
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private regexEscape(str: string): string {
|
||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
}
|
||||
|
||||
private replaceAll(input: string, searchValue: string, replaceValue: string): string {
|
||||
return input.replace(new RegExp(this.regexEscape(searchValue), 'g'), replaceValue);
|
||||
}
|
||||
|
||||
private indent(count: number): string {
|
||||
let pad = '';
|
||||
for (let i = 0; i < count; i++) {
|
||||
pad += ' ';
|
||||
}
|
||||
|
||||
return pad;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* THIS FILE WAS GENERATED FROM msft-sme-build. DO NOT MODIFY. To change this file, make the appropriate changes in build
|
||||
*
|
||||
* @license
|
||||
* Copyright (c) Microsoft. All rights reserved.
|
||||
*
|
||||
* @module
|
||||
* @description
|
||||
* Entry point for all public APIs of this project.
|
||||
*/
|
||||
export * from './dist/main';
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* THIS FILE WAS GENERATED FROM msft-sme-build. DO NOT MODIFY. To change this file, make the appropriate changes in build
|
||||
*
|
||||
* @license
|
||||
* Copyright (c) Microsoft. All rights reserved.
|
||||
*
|
||||
* @module
|
||||
* @description
|
||||
* Entry point for all public APIs of this project.
|
||||
*/
|
||||
export * from './dist/main';
|
|
@ -1,95 +0,0 @@
|
|||
{
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@msft-sme/iframe",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"peerDependencies": {
|
||||
"@msft-sme/shell": "0.312.0",
|
||||
"@angular/animations": "5.1.2",
|
||||
"@angular/common": "5.1.2",
|
||||
"@angular/compiler": "5.1.2",
|
||||
"@angular/core": "5.1.2",
|
||||
"@angular/forms": "5.1.2",
|
||||
"@angular/language-service": "5.1.2",
|
||||
"@angular/platform-browser": "5.1.2",
|
||||
"@angular/platform-browser-dynamic": "5.1.2",
|
||||
"@angular/router": "5.1.2",
|
||||
"chart.js": "2.4.0",
|
||||
"bootstrap": "3.3.7",
|
||||
"core-js": "2.5.3",
|
||||
"primeng": "4.1.0",
|
||||
"rxjs": "5.5.6",
|
||||
"winstrap": "0.5.11",
|
||||
"zone.js": "0.8.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@msft-sme/build": "file:./packages/@msft-sme/build",
|
||||
"@msft-sme/shell": "file:./packages/@msft-sme/shell",
|
||||
"@angular/animations": "5.1.2",
|
||||
"@angular/cli": "1.6.5",
|
||||
"@angular/common": "5.1.2",
|
||||
"@angular/compiler": "5.1.2",
|
||||
"@angular/compiler-cli": "5.1.2",
|
||||
"@angular/core": "5.1.2",
|
||||
"@angular/forms": "5.1.2",
|
||||
"@angular/language-service": "5.1.2",
|
||||
"@angular/platform-browser": "5.1.2",
|
||||
"@angular/platform-browser-dynamic": "5.1.2",
|
||||
"@angular/router": "5.1.2",
|
||||
"@types/chart.js": "0.0.8",
|
||||
"@types/jasmine": "^2.5.54",
|
||||
"@types/jasminewd2": "^2.0.3",
|
||||
"@types/jquery": "3.2.17",
|
||||
"@types/node": "^8.5.2",
|
||||
"@types/signalr": "2.2.35",
|
||||
"ansi-colors": "1.0.1",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-es2015": "^6.22.0",
|
||||
"bootstrap": "3.3.7",
|
||||
"chart.js": "2.4.0",
|
||||
"codelyzer": "^4.0.2",
|
||||
"core-js": "2.5.3",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-batch": "1.0.5",
|
||||
"gulp-clean": "0.3.2",
|
||||
"gulp-inline-ng2-template": "4.1.0",
|
||||
"gulp-jasmine": "2.4.2",
|
||||
"gulp-ngc": "0.3.0",
|
||||
"gulp-plumber": "1.1.0",
|
||||
"gulp-rename": "1.2.2",
|
||||
"gulp-sourcemaps": "^2.6.2",
|
||||
"gulp-tslint": "8.1.2",
|
||||
"gulp-typescript": "^3.2.3",
|
||||
"gulp-watch": "4.3.11",
|
||||
"jasmine-core": "^2.6.4",
|
||||
"jasmine-node": "1.14.5",
|
||||
"jasmine-reporters": "2.2.1",
|
||||
"jasmine-spec-reporter": "^4.1.1",
|
||||
"jasmine-terminal-reporter": "1.0.3",
|
||||
"jquery": "^3.2.1",
|
||||
"jsdom": "9.10.0",
|
||||
"karma": "^1.7.1",
|
||||
"karma-chrome-launcher": "^2.1.1",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
||||
"karma-jasmine": "^1.1.1",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"karma-remap-istanbul": "^0.2.1",
|
||||
"ping": "0.2.2",
|
||||
"primeng": "4.1.0",
|
||||
"protractor": "^5.1.2",
|
||||
"run-sequence": "2.2.0",
|
||||
"rxjs": "5.5.6",
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"signalr": "^2.2.2",
|
||||
"ts-helpers": "^1.1.1",
|
||||
"ts-node": "^4.1.0",
|
||||
"tslint": "^5.7.0",
|
||||
"tslint-eslint-rules": "4.1.1",
|
||||
"tslint-microsoft-contrib": "5.0.1",
|
||||
"typescript": "2.5.3",
|
||||
"winstrap": "0.5.11",
|
||||
"zone.js": "0.8.18"
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
export declare const newline = "\n";
|
||||
export declare const spacer = "\t";
|
||||
export declare type TargetFileType = 'ts' | 'css';
|
||||
export declare type InputFileType = 'ps1' | 'html' | 'svg' | 'css' | string;
|
||||
export interface StringMap<T> {
|
||||
[key: string]: T;
|
||||
}
|
||||
export interface NumberMap<T> {
|
||||
[key: number]: T;
|
||||
}
|
||||
export interface FileCallback {
|
||||
(err: Error, file: string): void;
|
||||
}
|
||||
export interface InputFileProcessor {
|
||||
readonly inputType: InputFileType;
|
||||
readonly supportedTargets: TargetFileType[];
|
||||
escape: (file: string, targetType: TargetFileType) => string;
|
||||
process: (file: string, targetType: TargetFileType, callback: FileCallback) => void;
|
||||
}
|
||||
export interface CollectedFileMap {
|
||||
[path: string]: string | CollectedFileMap;
|
||||
}
|
||||
export interface TargetFileGenerator {
|
||||
readonly targetType: TargetFileType;
|
||||
generate: (files: CollectedFileMap, options: ClassifyOptions, callback: FileCallback) => void;
|
||||
}
|
||||
export interface ClassifyOptions {
|
||||
rootClass: string;
|
||||
outFileName?: string;
|
||||
pathTransformRoot?: string;
|
||||
pathTransform?: (path: string, file: string) => string[];
|
||||
processors: InputFileProcessor[];
|
||||
generators: TargetFileGenerator[];
|
||||
}
|
||||
export declare function regexEscape(str: string): string;
|
||||
export declare function regexReplaceAll(input: string, searchValue: string, replaceValue: string): string;
|
|
@ -1,14 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.newline = '\n';
|
||||
exports.spacer = '\t';
|
||||
function regexEscape(str) {
|
||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
}
|
||||
exports.regexEscape = regexEscape;
|
||||
function regexReplaceAll(input, searchValue, replaceValue) {
|
||||
return input.replace(new RegExp(regexEscape(searchValue), 'g'), replaceValue);
|
||||
}
|
||||
exports.regexReplaceAll = regexReplaceAll;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9jbGFzc2lmeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNhLFFBQUEsT0FBTyxHQUFHLElBQUksQ0FBQztBQUNmLFFBQUEsTUFBTSxHQUFHLElBQUksQ0FBQztBQW9DM0IscUJBQTRCLEdBQVc7SUFDbkMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMscUNBQXFDLEVBQUUsTUFBTSxDQUFDLENBQUM7QUFDdEUsQ0FBQztBQUZELGtDQUVDO0FBRUQseUJBQWdDLEtBQWEsRUFBRSxXQUFtQixFQUFFLFlBQW9CO0lBQ3BGLE1BQU0sQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLElBQUksTUFBTSxDQUFDLFdBQVcsQ0FBQyxXQUFXLENBQUMsRUFBRSxHQUFHLENBQUMsRUFBRSxZQUFZLENBQUMsQ0FBQztBQUNsRixDQUFDO0FBRkQsMENBRUMiLCJmaWxlIjoiY2xhc3NpZnkvY2xhc3NpZnkuanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,8 +0,0 @@
|
|||
import { ClassifyOptions, CollectedFileMap, FileCallback, TargetFileGenerator, TargetFileType } from '../classify';
|
||||
export declare class BaseGenerator implements TargetFileGenerator {
|
||||
targetType: TargetFileType;
|
||||
static pluginName: string;
|
||||
static pluginVersion: string;
|
||||
constructor(targetType: TargetFileType);
|
||||
generate(files: CollectedFileMap, options: ClassifyOptions, callback: FileCallback): void;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../../util/util");
|
||||
/**
|
||||
* {0} - Plugin name
|
||||
* {1} - Plugin version
|
||||
*/
|
||||
var fileCommentFormat = "/**\n * @file Source code generated by {0}.\n * @version {1}\n */";
|
||||
var BaseGenerator = /** @class */ (function () {
|
||||
function BaseGenerator(targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
BaseGenerator.prototype.generate = function (files, options, callback) {
|
||||
callback(null, util.format(fileCommentFormat, BaseGenerator.pluginName, BaseGenerator.pluginVersion));
|
||||
};
|
||||
BaseGenerator.pluginName = '';
|
||||
BaseGenerator.pluginVersion = '';
|
||||
return BaseGenerator;
|
||||
}());
|
||||
exports.BaseGenerator = BaseGenerator;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9nZW5lcmF0b3JzL2Jhc2VHZW5lcmF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxzQ0FBeUM7QUFHekM7OztHQUdHO0FBQ0gsSUFBTSxpQkFBaUIsR0FBRyxtRUFHdEIsQ0FBQztBQUVMO0lBSUksdUJBQW1CLFVBQTBCO1FBQTFCLGVBQVUsR0FBVixVQUFVLENBQWdCO0lBQUksQ0FBQztJQUUzQyxnQ0FBUSxHQUFmLFVBQWdCLEtBQXVCLEVBQUUsT0FBd0IsRUFBRSxRQUFzQjtRQUNyRixRQUFRLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxNQUFNLENBQUMsaUJBQWlCLEVBQUUsYUFBYSxDQUFDLFVBQVUsRUFBRSxhQUFhLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztJQUMxRyxDQUFDO0lBUGEsd0JBQVUsR0FBRyxFQUFFLENBQUM7SUFDaEIsMkJBQWEsR0FBRyxFQUFFLENBQUM7SUFPckMsb0JBQUM7Q0FURCxBQVNDLElBQUE7QUFUWSxzQ0FBYSIsImZpbGUiOiJjbGFzc2lmeS9nZW5lcmF0b3JzL2Jhc2VHZW5lcmF0b3IuanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,6 +0,0 @@
|
|||
import { ClassifyOptions, CollectedFileMap, FileCallback } from '../classify';
|
||||
import { BaseGenerator } from './baseGenerator';
|
||||
export declare class BaseTSGenerator extends BaseGenerator {
|
||||
constructor();
|
||||
generate(files: CollectedFileMap, options: ClassifyOptions, callback: FileCallback): void;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../../util/util");
|
||||
var classify_1 = require("../classify");
|
||||
var baseGenerator_1 = require("./baseGenerator");
|
||||
var tslintDisable = '/* tslint:disable */';
|
||||
var BaseTSGenerator = /** @class */ (function (_super) {
|
||||
__extends(BaseTSGenerator, _super);
|
||||
function BaseTSGenerator() {
|
||||
return _super.call(this, 'ts') || this;
|
||||
}
|
||||
BaseTSGenerator.prototype.generate = function (files, options, callback) {
|
||||
_super.prototype.generate.call(this, files, options, function (err, baseFile) {
|
||||
callback(err, util.format('{0}{2}\'use strict\'{2}{1}{2}', tslintDisable, baseFile, classify_1.newline));
|
||||
});
|
||||
};
|
||||
return BaseTSGenerator;
|
||||
}(baseGenerator_1.BaseGenerator));
|
||||
exports.BaseTSGenerator = BaseTSGenerator;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9nZW5lcmF0b3JzL2Jhc2VUU0dlbmVyYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxzQ0FBeUM7QUFDekMsd0NBQTRIO0FBQzVILGlEQUFnRDtBQUVoRCxJQUFNLGFBQWEsR0FBRyxzQkFBc0IsQ0FBQztBQUU3QztJQUFxQyxtQ0FBYTtJQUM5QztlQUFnQixrQkFBTSxJQUFJLENBQUM7SUFBRSxDQUFDO0lBRXZCLGtDQUFRLEdBQWYsVUFBZ0IsS0FBdUIsRUFBRSxPQUF3QixFQUFFLFFBQXNCO1FBQ3JGLGlCQUFNLFFBQVEsWUFBQyxLQUFLLEVBQUUsT0FBTyxFQUFFLFVBQUMsR0FBRyxFQUFFLFFBQVE7WUFDekMsUUFBUSxDQUFDLEdBQUcsRUFBRSxJQUFJLENBQUMsTUFBTSxDQUFDLCtCQUErQixFQUFFLGFBQWEsRUFBRSxRQUFRLEVBQUUsa0JBQU8sQ0FBQyxDQUFDLENBQUM7UUFDbEcsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDO0lBQ0wsc0JBQUM7QUFBRCxDQVJBLEFBUUMsQ0FSb0MsNkJBQWEsR0FRakQ7QUFSWSwwQ0FBZSIsImZpbGUiOiJjbGFzc2lmeS9nZW5lcmF0b3JzL2Jhc2VUU0dlbmVyYXRvci5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiJDOlxcQkFcXDQxN1xccyJ9
|
|
@ -1,7 +0,0 @@
|
|||
import { ClassifyOptions, CollectedFileMap, FileCallback } from '../classify';
|
||||
import { BaseGenerator } from './baseGenerator';
|
||||
export declare class CssBackgroundImageGenerator extends BaseGenerator {
|
||||
constructor();
|
||||
private getCssClasses(collection, prefix);
|
||||
generate(files: CollectedFileMap, options: ClassifyOptions, callback: FileCallback): void;
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../../util/util");
|
||||
var classify_1 = require("../classify");
|
||||
var baseGenerator_1 = require("./baseGenerator");
|
||||
/**
|
||||
* {0} - module prefix
|
||||
* {2} - constant name
|
||||
* {4} - constant value
|
||||
*/
|
||||
var cssClassFormat = ".{0} {\n background-image: url(\"data:image/svg+xml;charset=utf8,{1}\");\n}";
|
||||
var CssBackgroundImageGenerator = /** @class */ (function (_super) {
|
||||
__extends(CssBackgroundImageGenerator, _super);
|
||||
function CssBackgroundImageGenerator() {
|
||||
return _super.call(this, 'css') || this;
|
||||
}
|
||||
CssBackgroundImageGenerator.prototype.getCssClasses = function (collection, prefix) {
|
||||
var _this = this;
|
||||
var constants = [];
|
||||
var modules = [];
|
||||
// sort the keys here so they end up sorted in the final file
|
||||
var keys = Object.keys(collection).sort();
|
||||
keys.forEach(function (key) {
|
||||
var value = collection[key];
|
||||
var className = util.format('{0}-{1}', prefix, key);
|
||||
if (util.isString(value)) {
|
||||
constants.push(util.format(cssClassFormat, className, value));
|
||||
}
|
||||
else {
|
||||
var moduleClasses = _this.getCssClasses(value, className + '-');
|
||||
modules.push(moduleClasses);
|
||||
}
|
||||
});
|
||||
return constants.concat(modules).join(classify_1.newline);
|
||||
};
|
||||
CssBackgroundImageGenerator.prototype.generate = function (files, options, callback) {
|
||||
var _this = this;
|
||||
_super.prototype.generate.call(this, files, options, function (err, header) {
|
||||
var classes = _this.getCssClasses(files, options.rootClass.toLowerCase());
|
||||
callback(err, util.format('{0}{1}{2}', header, classify_1.newline, classes));
|
||||
});
|
||||
};
|
||||
return CssBackgroundImageGenerator;
|
||||
}(baseGenerator_1.BaseGenerator));
|
||||
exports.CssBackgroundImageGenerator = CssBackgroundImageGenerator;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9nZW5lcmF0b3JzL2Nzc0JhY2tncm91bmRJbWFnZUdlbmVyYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxzQ0FBeUM7QUFDekMsd0NBQW9JO0FBQ3BJLGlEQUFnRDtBQUVoRDs7OztHQUlHO0FBQ0gsSUFBTSxjQUFjLEdBQUcsZ0ZBRXJCLENBQUM7QUFFSDtJQUFpRCwrQ0FBYTtJQUUxRDtlQUFnQixrQkFBTSxLQUFLLENBQUM7SUFBRSxDQUFDO0lBRXZCLG1EQUFhLEdBQXJCLFVBQXNCLFVBQTRCLEVBQUUsTUFBYztRQUFsRSxpQkFnQkM7UUFmRyxJQUFJLFNBQVMsR0FBRyxFQUFFLENBQUM7UUFDbkIsSUFBSSxPQUFPLEdBQUcsRUFBRSxDQUFDO1FBQ2pCLDZEQUE2RDtRQUM3RCxJQUFJLElBQUksR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQzFDLElBQUksQ0FBQyxPQUFP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FLFFBQVEsQ0FBQyxHQUFHLEVBQUUsSUFBSSxDQUFDLE1BQU0sQ0FBQyxXQUFXLEVBQUUsTUFBTSxFQUFFLGtCQUFPLEVBQUUsT0FBTyxDQUFDLENBQUMsQ0FBQztRQUN0RSxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUM7SUFDTCxrQ0FBQztBQUFELENBNUJBLEFBNEJDLENBNUJnRCw2QkFBYSxHQTRCN0Q7QUE1Qlksa0VBQTJCIiwiZmlsZSI6ImNsYXNzaWZ5L2dlbmVyYXRvcnMvY3NzQmFja2dyb3VuZEltYWdlR2VuZXJhdG9yLmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,12 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var cssBackgroundImageGenerator_1 = require("./cssBackgroundImageGenerator");
|
||||
var tsNestedModuleGenerator_1 = require("./tsNestedModuleGenerator");
|
||||
var tsSingleConstantGenerator_1 = require("./tsSingleConstantGenerator");
|
||||
module.exports = {
|
||||
CssBackgroundImageGenerator: cssBackgroundImageGenerator_1.CssBackgroundImageGenerator,
|
||||
TSNestedModuleGenerator: tsNestedModuleGenerator_1.TSNestedModuleGenerator,
|
||||
TSSingleConstantGenerator: tsSingleConstantGenerator_1.TSSingleConstantGenerator
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9nZW5lcmF0b3JzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkVBQTRFO0FBQzVFLHFFQUFvRTtBQUNwRSx5RUFBd0U7QUFFeEUsTUFBTSxDQUFDLE9BQU8sR0FBRztJQUNiLDJCQUEyQixFQUFFLHlEQUEyQjtJQUN4RCx1QkFBdUIsRUFBRSxpREFBdUI7SUFDaEQseUJBQXlCLEVBQUUscURBQXlCO0NBQ3ZELENBQUMiLCJmaWxlIjoiY2xhc3NpZnkvZ2VuZXJhdG9ycy9pbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiJDOlxcQkFcXDQxN1xccyJ9
|
|
@ -1,6 +0,0 @@
|
|||
import { ClassifyOptions, CollectedFileMap, FileCallback } from '../classify';
|
||||
import { BaseTSGenerator } from './baseTSGenerator';
|
||||
export declare class TSNestedModuleGenerator extends BaseTSGenerator {
|
||||
private getTsModule(files, spacerValue);
|
||||
generate(files: CollectedFileMap, options: ClassifyOptions, callback: FileCallback): void;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../../util/util");
|
||||
var classify_1 = require("../classify");
|
||||
var baseTSGenerator_1 = require("./baseTSGenerator");
|
||||
/**
|
||||
* {0} - module name
|
||||
* {1} - module contents
|
||||
* {2} - spacer
|
||||
*/
|
||||
var tsModuleFormat = "{2}export module {0} {\n{1}\n{2}}";
|
||||
/**
|
||||
* {0} - constant name
|
||||
* {1} - constant value
|
||||
* {2} - spacer
|
||||
*/
|
||||
var tsConstantFormat = '{2}export const {0}: string = \'{1}\';';
|
||||
var TSNestedModuleGenerator = /** @class */ (function (_super) {
|
||||
__extends(TSNestedModuleGenerator, _super);
|
||||
function TSNestedModuleGenerator() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
TSNestedModuleGenerator.prototype.getTsModule = function (files, spacerValue) {
|
||||
var _this = this;
|
||||
var constants = [];
|
||||
var modules = [];
|
||||
// sort the keys here so they end up sorted in the final file
|
||||
var keys = Object.keys(files).sort();
|
||||
keys.forEach(function (key) {
|
||||
// get value from collection
|
||||
var value = files[key];
|
||||
// make sure key is safe for typescript
|
||||
key = key.replace(/-+(.)/g, function (d) { return d[d.length - 1].toUpperCase(); });
|
||||
if (util.isString(value)) {
|
||||
constants.push(util.format(tsConstantFormat, key, value, spacerValue));
|
||||
}
|
||||
else {
|
||||
var content = _this.getTsModule(value, spacerValue + classify_1.spacer);
|
||||
modules.push(util.format(tsModuleFormat, key, content, spacerValue));
|
||||
}
|
||||
});
|
||||
return constants.concat(modules).join(classify_1.newline);
|
||||
};
|
||||
TSNestedModuleGenerator.prototype.generate = function (files, options, callback) {
|
||||
var _this = this;
|
||||
_super.prototype.generate.call(this, files, options, function (err, header) {
|
||||
var content = _this.getTsModule(files, classify_1.spacer);
|
||||
var rootModule = util.format(tsModuleFormat, options.rootClass, content, '');
|
||||
callback(err, util.format('{0}{1}{2}', header, classify_1.newline, rootModule));
|
||||
});
|
||||
};
|
||||
return TSNestedModuleGenerator;
|
||||
}(baseTSGenerator_1.BaseTSGenerator));
|
||||
exports.TSNestedModuleGenerator = TSNestedModuleGenerator;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9nZW5lcmF0b3JzL3RzTmVzdGVkTW9kdWxlR2VuZXJhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLHNDQUF5QztBQUN6Qyx3Q0FBb0k7QUFDcEkscURBQW9EO0FBRXBEOzs7O0dBSUc7QUFDSCxJQUFNLGNBQWMsR0FBRyxtQ0FFbEIsQ0FBQztBQUVOOzs7O0dBSUc7QUF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vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,6 +0,0 @@
|
|||
import { ClassifyOptions, CollectedFileMap, FileCallback } from '../classify';
|
||||
import { BaseTSGenerator } from './baseTSGenerator';
|
||||
export declare class TSSingleConstantGenerator extends BaseTSGenerator {
|
||||
private getTsModule(files, spacerValue);
|
||||
generate(files: CollectedFileMap, options: ClassifyOptions, callback: FileCallback): void;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../../util/util");
|
||||
var classify_1 = require("../classify");
|
||||
var baseTSGenerator_1 = require("./baseTSGenerator");
|
||||
/**
|
||||
* {0} - module name
|
||||
* {1} - properties
|
||||
*/
|
||||
var tsRootModuleFormat = "export const {0} = {\n{1}\n};";
|
||||
/**
|
||||
* {0} - module name
|
||||
* {1} - properties
|
||||
* {2} - spacer
|
||||
*/
|
||||
var tsSubModuleFormat = "{2}'{0}': {\n{1}\n{2}}";
|
||||
/**
|
||||
* {0} - property name
|
||||
* {1} - property value
|
||||
* {2} - spacer
|
||||
*/
|
||||
var tsValueFormat = "{2}{0}: '{1}'";
|
||||
var TSSingleConstantGenerator = /** @class */ (function (_super) {
|
||||
__extends(TSSingleConstantGenerator, _super);
|
||||
function TSSingleConstantGenerator() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
TSSingleConstantGenerator.prototype.getTsModule = function (files, spacerValue) {
|
||||
var _this = this;
|
||||
var constants = [];
|
||||
var modules = [];
|
||||
// sort the keys here so they end up sorted in the final file
|
||||
var keys = Object.keys(files).sort();
|
||||
keys.forEach(function (key) {
|
||||
// get value from collection
|
||||
var value = files[key];
|
||||
// make sure key is safe for typescript
|
||||
key = key.replace(/-+(.)/g, function (d) { return d[d.length - 1].toUpperCase(); });
|
||||
if (util.isString(value)) {
|
||||
constants.push(util.format(tsValueFormat, key, value, spacerValue));
|
||||
}
|
||||
else {
|
||||
var content = _this.getTsModule(value, spacerValue + classify_1.spacer);
|
||||
modules.push(util.format(tsSubModuleFormat, key, content, spacerValue));
|
||||
}
|
||||
});
|
||||
var joint = util.format(',{0}', classify_1.newline);
|
||||
return constants.concat(modules).join(joint);
|
||||
};
|
||||
TSSingleConstantGenerator.prototype.generate = function (files, options, callback) {
|
||||
var _this = this;
|
||||
_super.prototype.generate.call(this, files, options, function (err, header) {
|
||||
var content = _this.getTsModule(files, classify_1.spacer);
|
||||
var rootModule = util.format(tsRootModuleFormat, options.rootClass, content);
|
||||
callback(err, util.format('{0}{1}{2}', header, classify_1.newline, rootModule));
|
||||
});
|
||||
};
|
||||
return TSSingleConstantGenerator;
|
||||
}(baseTSGenerator_1.BaseTSGenerator));
|
||||
exports.TSSingleConstantGenerator = TSSingleConstantGenerator;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9nZW5lcmF0b3JzL3RzU2luZ2xlQ29uc3RhbnRHZW5lcmF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsc0NBQXlDO0FBQ3pDLHdDQUFvSTtBQUNwSSxxREFBb0Q7QUFFcEQ7OztHQUdHO0FBQ0gsSUFBTSxrQkFBa0IsR0FBRywrQkFFeEIsQ0FBQztBQUVKOzs7O0dBSUc7QUFDSCxJQUFNLGlCQUFpQixHQUFHLHdCQUVyQixDQUFDO0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bmVyYXRvcnMvdHNTaW5nbGVDb25zdGFudEdlbmVyYXRvci5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiJDOlxcQkFcXDQxN1xccyJ9
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,9 +0,0 @@
|
|||
import { FileCallback, InputFileProcessor, InputFileType, TargetFileType } from '../classify';
|
||||
export declare class BaseFileProcessor implements InputFileProcessor {
|
||||
inputType: InputFileType;
|
||||
supportedTargets: TargetFileType[];
|
||||
constructor(inputType: InputFileType, supportedTargets: TargetFileType[]);
|
||||
verifySupport(targetType: TargetFileType): void;
|
||||
escape(input: string, targetType: TargetFileType): string;
|
||||
process(file: any, targetType: TargetFileType, callback: FileCallback): void;
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../../util/util");
|
||||
var classify_1 = require("../classify");
|
||||
var BaseFileProcessor = /** @class */ (function () {
|
||||
function BaseFileProcessor(inputType, supportedTargets) {
|
||||
this.inputType = inputType;
|
||||
this.supportedTargets = supportedTargets;
|
||||
}
|
||||
BaseFileProcessor.prototype.verifySupport = function (targetType) {
|
||||
if (!this.supportedTargets.some(function (supported) { return supported === targetType; })) {
|
||||
var message = util.format('Unsupported target type: {0}. The supported types for this file processor are: {1}', targetType, this.supportedTargets);
|
||||
throw new Error(message);
|
||||
}
|
||||
};
|
||||
BaseFileProcessor.prototype.escape = function (input, targetType) {
|
||||
this.verifySupport(targetType);
|
||||
input = classify_1.regexReplaceAll(input, '\\', '\\\\');
|
||||
input = classify_1.regexReplaceAll(input, '\'', '\\\'');
|
||||
return input;
|
||||
};
|
||||
BaseFileProcessor.prototype.process = function (file, targetType, callback) {
|
||||
this.verifySupport(targetType);
|
||||
callback(null, file.contents.toString('utf8'));
|
||||
};
|
||||
return BaseFileProcessor;
|
||||
}());
|
||||
exports.BaseFileProcessor = BaseFileProcessor;
|
||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FBQztJQUNqQixDQUFDO0lBRU0sbUNBQU8sR0FBZCxVQUFlLElBQVMsRUFBRSxVQUEwQixFQUFFLFFBQXNCO1FBQ3hFLElBQUksQ0FBQyxhQUFhLENBQUMsVUFBVSxDQUFDLENBQUM7UUFDL0IsUUFBUSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO0lBQ25ELENBQUM7SUFDTCx3QkFBQztBQUFELENBeEJBLEFBd0JDLElBQUE7QUF4QlksOENBQWlCIiwiZmlsZSI6ImNsYXNzaWZ5L3Byb2Nlc3NvcnMvYmFzZVByb2Nlc3Nvci5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiJDOlxcQkFcXDQxN1xccyJ9
|
|
@ -1,11 +0,0 @@
|
|||
import { FileCallback, TargetFileType } from '../classify';
|
||||
import { BaseFileProcessor } from './baseProcessor';
|
||||
/**
|
||||
* Input File Processor for CSS files. Uses html-minifier internally.
|
||||
* See https://github.com/jakubpawlowicz/clean-css for valid options
|
||||
*/
|
||||
export declare class CSSFileProcessor extends BaseFileProcessor {
|
||||
private options;
|
||||
constructor(options: any);
|
||||
process(file: any, targetType: TargetFileType, callback: FileCallback): void;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var gutil = require("gulp-util");
|
||||
var util = require("../../util/util");
|
||||
var baseProcessor_1 = require("./baseProcessor");
|
||||
// no typings available for clean-css v. 4 or higher, so require it without typings
|
||||
var cleanCSS = require('clean-css');
|
||||
var defaultOptions = {
|
||||
level: {
|
||||
1: {
|
||||
all: true,
|
||||
specialComments: 0
|
||||
},
|
||||
2: {
|
||||
all: false
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Input File Processor for CSS files. Uses html-minifier internally.
|
||||
* See https://github.com/jakubpawlowicz/clean-css for valid options
|
||||
*/
|
||||
var CSSFileProcessor = /** @class */ (function (_super) {
|
||||
__extends(CSSFileProcessor, _super);
|
||||
function CSSFileProcessor(options) {
|
||||
var _this = _super.call(this, 'css', ['ts']) || this;
|
||||
_this.options = options;
|
||||
_this.options = util.extend({}, [defaultOptions, options]);
|
||||
return _this;
|
||||
}
|
||||
CSSFileProcessor.prototype.process = function (file, targetType, callback) {
|
||||
var _this = this;
|
||||
_super.prototype.process.call(this, file, targetType, function (err, preProcessedFile) {
|
||||
if (!err) {
|
||||
var output = new cleanCSS(_this.options).minify(preProcessedFile);
|
||||
if (output.warnings) {
|
||||
output.warnings.forEach(function (w) { return gutil.log(gutil.colors.yellow(w)); });
|
||||
}
|
||||
if (output.errors) {
|
||||
err = output.errors.join('\n');
|
||||
}
|
||||
preProcessedFile = output.styles;
|
||||
}
|
||||
callback(err, preProcessedFile);
|
||||
});
|
||||
};
|
||||
return CSSFileProcessor;
|
||||
}(baseProcessor_1.BaseFileProcessor));
|
||||
exports.CSSFileProcessor = CSSFileProcessor;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9wcm9jZXNzb3JzL2Nzc1Byb2Nlc3Nvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxpQ0FBb0M7QUFDcEMsc0NBQXlDO0FBRXpDLGlEQUFvRDtBQUVwRCxtRkF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xVQUFBLENBQUMsSUFBSSxPQUFBLEtBQUssQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBakMsQ0FBaUMsQ0FBQyxDQUFDO2dCQUNwRSxDQUFDO2dCQUNELEVBQUUsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO29CQUNoQixHQUFHLEdBQUcsTUFBTSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ25DLENBQUM7Z0JBRUQsZ0JBQWdCLEdBQUcsTUFBTSxDQUFDLE1BQU0sQ0FBQztZQUNyQyxDQUFDO1lBQ0QsUUFBUSxDQUFDLEdBQUcsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO1FBQ3BDLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQztJQUNMLHVCQUFDO0FBQUQsQ0F4QkEsQUF3QkMsQ0F4QnFDLGlDQUFpQixHQXdCdEQ7QUF4QlksNENBQWdCIiwiZmlsZSI6ImNsYXNzaWZ5L3Byb2Nlc3NvcnMvY3NzUHJvY2Vzc29yLmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,13 +0,0 @@
|
|||
/// <reference types="html-minifier" />
|
||||
import HTMLMinifier = require('html-minifier');
|
||||
import { FileCallback, TargetFileType } from '../classify';
|
||||
import { BaseFileProcessor } from './baseProcessor';
|
||||
/**
|
||||
* Input File Processor for HTML files. Uses html-minifier internally.
|
||||
* See https://github.com/kangax/html-minifier for options
|
||||
*/
|
||||
export declare class HTMLFileProcessor extends BaseFileProcessor {
|
||||
private options;
|
||||
constructor(options: HTMLMinifier.Options);
|
||||
process(file: any, targetType: TargetFileType, callback: FileCallback): void;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var HTMLMinifier = require("html-minifier");
|
||||
var util = require("../../util/util");
|
||||
var baseProcessor_1 = require("./baseProcessor");
|
||||
var defaultOptions = {
|
||||
collapseWhitespace: true,
|
||||
removeComments: true,
|
||||
// The following attributes are required so that angular attributes and bindings ar preserved
|
||||
removeAttributeQuotes: false,
|
||||
caseSensitive: true,
|
||||
customAttrSurround: [[/#/, /(?:)/], [/\*/, /(?:)/], [/\[?\(?/, /(?:)/]],
|
||||
customAttrAssign: [/\)?\]?=/]
|
||||
};
|
||||
/**
|
||||
* Input File Processor for HTML files. Uses html-minifier internally.
|
||||
* See https://github.com/kangax/html-minifier for options
|
||||
*/
|
||||
var HTMLFileProcessor = /** @class */ (function (_super) {
|
||||
__extends(HTMLFileProcessor, _super);
|
||||
function HTMLFileProcessor(options) {
|
||||
var _this = _super.call(this, 'html', ['ts']) || this;
|
||||
_this.options = options;
|
||||
_this.options = util.extend({}, [defaultOptions, options]);
|
||||
return _this;
|
||||
}
|
||||
HTMLFileProcessor.prototype.process = function (file, targetType, callback) {
|
||||
var _this = this;
|
||||
_super.prototype.process.call(this, file, targetType, function (err, preProcessedFile) {
|
||||
if (!err) {
|
||||
preProcessedFile = HTMLMinifier.minify(preProcessedFile, _this.options);
|
||||
}
|
||||
callback(err, preProcessedFile);
|
||||
});
|
||||
};
|
||||
return HTMLFileProcessor;
|
||||
}(baseProcessor_1.BaseFileProcessor));
|
||||
exports.HTMLFileProcessor =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RSxVQUFVLEVBQUUsVUFBQyxHQUFHLEVBQUUsZ0JBQWdCO1lBQ2xELEVBQUUsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztnQkFDUCxnQkFBZ0IsR0FBRyxZQUFZLENBQUMsTUFBTSxDQUFDLGdCQUFnQixFQUFFLEtBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztZQUMzRSxDQUFDO1lBQ0QsUUFBUSxDQUFDLEdBQUcsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO1FBQ3BDLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQztJQUNMLHdCQUFDO0FBQUQsQ0FmQSxBQWVDLENBZnNDLGlDQUFpQixHQWV2RDtBQWZZLDhDQUFpQiIsImZpbGUiOiJjbGFzc2lmeS9wcm9jZXNzb3JzL2h0bWxQcm9jZXNzb3IuanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,14 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var cssProcessor_1 = require("./cssProcessor");
|
||||
var htmlProcessor_1 = require("./htmlProcessor");
|
||||
var powershellProcessor_1 = require("./powershellProcessor");
|
||||
var svgProcessor_1 = require("./svgProcessor");
|
||||
module.exports = {
|
||||
CSSFileProcessor: cssProcessor_1.CSSFileProcessor,
|
||||
HTMLFileProcessor: htmlProcessor_1.HTMLFileProcessor,
|
||||
SVGFileProcessor: svgProcessor_1.SVGFileProcessor,
|
||||
PowerShellFileProcessor: powershellProcessor_1.PowerShellFileProcessor
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9wcm9jZXNzb3JzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQWtEO0FBQ2xELGlEQUFvRDtBQUNwRCw2REFBZ0c7QUFDaEcsK0NBQWtEO0FBRWxELE1BQU0sQ0FBQyxPQUFPLEdBQUc7SUFDYixnQkFBZ0IsRUFBRSwrQkFBZ0I7SUFDbEMsaUJBQWlCLEVBQUUsaUNBQWlCO0lBQ3BDLGdCQUFnQixFQUFFLCtCQUFnQjtJQUNsQyx1QkFBdUIsRUFBRSw2Q0FBdUI7Q0FDbkQsQ0FBQyIsImZpbGUiOiJjbGFzc2lmeS9wcm9jZXNzb3JzL2luZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,15 +0,0 @@
|
|||
import { FileCallback, TargetFileType } from '../classify';
|
||||
import { BaseFileProcessor } from './baseProcessor';
|
||||
export interface PowershellFileProcessorOptions {
|
||||
removeComments?: boolean;
|
||||
}
|
||||
/**
|
||||
* Input File Processor for powershell files
|
||||
* TODO: Find or build a simple powershell minifier? maybe: https://minifyps.codeplex.com/
|
||||
*/
|
||||
export declare class PowerShellFileProcessor extends BaseFileProcessor {
|
||||
private options;
|
||||
constructor(options: PowershellFileProcessorOptions);
|
||||
escape(input: string, targetType: TargetFileType): string;
|
||||
process(file: any, targetType: TargetFileType, callback: FileCallback): void;
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var path = require("path");
|
||||
var util = require("../../util/util");
|
||||
var classify_1 = require("../classify");
|
||||
var baseProcessor_1 = require("./baseProcessor");
|
||||
var defaultOptions = {
|
||||
removeComments: true
|
||||
};
|
||||
/**
|
||||
* Input File Processor for powershell files
|
||||
* TODO: Find or build a simple powershell minifier? maybe: https://minifyps.codeplex.com/
|
||||
*/
|
||||
var PowerShellFileProcessor = /** @class */ (function (_super) {
|
||||
__extends(PowerShellFileProcessor, _super);
|
||||
function PowerShellFileProcessor(options) {
|
||||
var _this = _super.call(this, 'ps1', ['ts']) || this;
|
||||
_this.options = options;
|
||||
_this.options = util.extend({}, [defaultOptions, options]);
|
||||
return _this;
|
||||
}
|
||||
PowerShellFileProcessor.prototype.escape = function (input, targetType) {
|
||||
// we are skipping our super class escape method to avoid a conflict with singe quote escaping
|
||||
// input = super.escape(input, targetType);
|
||||
this.verifySupport(targetType);
|
||||
// escape '\'
|
||||
input = classify_1.regexReplaceAll(input, '\\', '\\\\');
|
||||
// escape newlines
|
||||
input = classify_1.regexReplaceAll(input, '\n', '\\n');
|
||||
// copied from ps-code. Why are we escaping these?
|
||||
input = classify_1.regexReplaceAll(input, '\'', '\\u0027');
|
||||
input = classify_1.regexReplaceAll(input, '<', '\\u003c');
|
||||
input = classify_1.regexReplaceAll(input, '>', '\\u003e');
|
||||
input = classify_1.regexReplaceAll(input, '&', '\\u0026');
|
||||
return input;
|
||||
};
|
||||
PowerShellFileProcessor.prototype.process = function (file, targetType, callback) {
|
||||
var _this = this;
|
||||
_super.prototype.process.call(this, file, targetType, function (err, preProcessedFile) {
|
||||
if (!err) {
|
||||
var skipRemoveComments = preProcessedFile.search(/##RemoveComments=false##/) > -1;
|
||||
if (_this.options.removeComments && !skipRemoveComments) {
|
||||
// Powershell single line and multi line comments should be replaced with nothing
|
||||
preProcessedFile = preProcessedFile.replace(/#.*|<#[\s\S]*?#>/g, '');
|
||||
}
|
||||
// ensure consistent newlines
|
||||
preProcessedFile = preProcessedFile.replace(/(\r|\n|\r\n)+\s*/g, '\n');
|
||||
// remove newlines at the end of the file
|
||||
preProcessedFile = preProcessedFile.replace(/(\n)+$/g, '');
|
||||
// add helper for debugging which script is being run
|
||||
preProcessedFile = util.format('##{0}##\n{1}', path.parse(file.path).name, preProcessedFile);
|
||||
}
|
||||
callback(err, preProcessedFile);
|
||||
});
|
||||
};
|
||||
return PowerShellFileProcessor;
|
||||
}(baseProcessor_1.BaseFileProcessor));
|
||||
exports.PowerShellFileProcessor = PowerShellFileProcessor;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9wcm9jZXNzb3JzL3Bvd2Vyc2hlbGxQcm9jZXNzb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsMkJBQThCO0FBQzlCLHNDQUF5QztBQUN6Qyx3Q0FBb0c7QUFDcEcsaURBQW9EO0FBTXBELElBQU0sY0FBYyxHQUFtQztJQUNuRCxjQUFjLEVBQUUsSUFBSTtDQUN2QixDQUFDO0FBRUY7OztHQUdHO0FBQ0g7SUFBNkMsMkNBQWlCO0lBRTFELGlDQUFvQixPQUF1QztRQUEzRCxZQUNJLGtCQUFNLEtBQUssRUFBRSxDQUFDLElBQUksQ0FBQyxDQUFDLFNBRXZCO1FBSG1CLGFBQU8sR0FBUCxPQUFPLENBQWdDO1FBRXZELEtBQUksQ0FBQyxPQUFPLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxFQUFFLEVBQUUsQ0FBQyxjQUFjLEVBQUUsT0FBTyxDQUFDLENBQUMsQ0FBQzs7SUFDOUQsQ0FBQztJQUVNLHdDQUFNLEdBQWIsVUFBYyxLQUFhLEVBQUUsVUFBMEI7UUFDbkQsK0ZBQStGO1FBQy9GLDJDQUEyQztRQUUzQyxJQUFJLENBQUMsYUFBYSxDQUFDLFVBQVUsQ0FBQyxDQUFDO1FBRS9CLGFBQWE7UUFDYixLQUFLL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Z0IsR0FBRyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsbUJBQW1CLEVBQUUsRUFBRSxDQUFDLENBQUM7Z0JBQ3pFLENBQUM7Z0JBRUQsNkJBQTZCO2dCQUM3QixnQkFBZ0IsR0FBRyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsbUJBQW1CLEVBQUUsSUFBSSxDQUFDLENBQUM7Z0JBRXZFLHlDQUF5QztnQkFDekMsZ0JBQWdCLEdBQUcsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLFNBQVMsRUFBRSxFQUFFLENBQUMsQ0FBQztnQkFFM0QscURBQXFEO2dCQUNyRCxnQkFBZ0IsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztZQUVqRyxDQUFDO1lBQ0QsUUFBUSxDQUFDLEdBQUcsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO1FBQ3BDLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQztJQUNMLDhCQUFDO0FBQUQsQ0FsREEsQUFrREMsQ0FsRDRDLGlDQUFpQixHQWtEN0Q7QUFsRFksMERBQXVCIiwiZmlsZSI6ImNsYXNzaWZ5L3Byb2Nlc3NvcnMvcG93ZXJzaGVsbFByb2Nlc3Nvci5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiJDOlxcQkFcXDQxN1xccyJ9
|
|
@ -1,12 +0,0 @@
|
|||
import { FileCallback, TargetFileType } from '../classify';
|
||||
import { BaseFileProcessor } from './baseProcessor';
|
||||
/**
|
||||
* Input File Processor for svg files. Uses svgo internally.
|
||||
* See https://github.com/svg/svgo and https://github.com/svg/svgo/blob/master/docs/how-it-works/en.md#1-config for options
|
||||
*/
|
||||
export declare class SVGFileProcessor extends BaseFileProcessor {
|
||||
private options;
|
||||
constructor(options: any);
|
||||
escape(input: string, targetType: TargetFileType): string;
|
||||
process(file: any, targetType: TargetFileType, callback: FileCallback): void;
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../../util/util");
|
||||
var classify_1 = require("../classify");
|
||||
var baseProcessor_1 = require("./baseProcessor");
|
||||
// SVGO has no typings
|
||||
var SVGO = require('svgo');
|
||||
var defaultOptions = {};
|
||||
/**
|
||||
* Input File Processor for svg files. Uses svgo internally.
|
||||
* See https://github.com/svg/svgo and https://github.com/svg/svgo/blob/master/docs/how-it-works/en.md#1-config for options
|
||||
*/
|
||||
var SVGFileProcessor = /** @class */ (function (_super) {
|
||||
__extends(SVGFileProcessor, _super);
|
||||
function SVGFileProcessor(options) {
|
||||
var _this = _super.call(this, 'svg', ['ts', 'css']) || this;
|
||||
_this.options = options;
|
||||
_this.options = util.extend({}, [defaultOptions, options]);
|
||||
return _this;
|
||||
}
|
||||
SVGFileProcessor.prototype.escape = function (input, targetType) {
|
||||
input = _super.prototype.escape.call(this, input, targetType);
|
||||
if (targetType === 'css') {
|
||||
// edge / IE11 has an issue with unescaped svgs in css files
|
||||
input = classify_1.regexReplaceAll(input, '"', '\'');
|
||||
input = classify_1.regexReplaceAll(input, '%', '%25');
|
||||
input = classify_1.regexReplaceAll(input, '#', '%23');
|
||||
input = classify_1.regexReplaceAll(input, '{', '%7B');
|
||||
input = classify_1.regexReplaceAll(input, '}', '%7D');
|
||||
input = classify_1.regexReplaceAll(input, '<', '%3C');
|
||||
input = classify_1.regexReplaceAll(input, '>', '%3E');
|
||||
}
|
||||
return input;
|
||||
};
|
||||
SVGFileProcessor.prototype.process = function (file, targetType, callback) {
|
||||
var _this = this;
|
||||
_super.prototype.process.call(this, file, targetType, function (err, preProcessedFile) {
|
||||
if (err) {
|
||||
callback(err, preProcessedFile);
|
||||
return;
|
||||
}
|
||||
var svgo = new SVGO(_this.options);
|
||||
svgo.optimize(preProcessedFile).then(function (results) {
|
||||
callback(null, results.data);
|
||||
}, function (error) {
|
||||
callback(error, null);
|
||||
});
|
||||
});
|
||||
};
|
||||
return SVGFileProcessor;
|
||||
}(baseProcessor_1.BaseFileProcessor));
|
||||
exports.SVGFileProcessor = SVGFileProcessor;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jbGFzc2lmeS9wcm9jZXNzb3JzL3N2Z1Byb2Nlc3Nvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxzQ0FBeUM7QUFDekMsd0NBU3FCO0FBQ3JCLGlEQUFvRDtBQUVwRCxzQkFBc0I7QUFDdEIsSUFBTSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBRTdCLElBQU0sY0FBYyxHQUFHLEVBQUUsQ0FBQztBQUUxQjs7O0dBR0c7QUFDSDtJQUFzQyxvQ0FBaUI7SUFFbkQsMEJBQW9CLE9BQVk7UUFBaEMsWUFDSSxrQkFBTSxLQUFLLEVBQUUsQ0FBQyxJQUFJLEVBQUUsS0FBSyxDQUFDLENBQUMsU0FFOUI7UUFIbUIsYUFBTyxHQUFQLE9BQU8sQ0FBSztRQUU1QixLQUFJLENBQUMsT0FBTyxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUMsRUFBRSxFQUFFLEN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RSxVQUFVLEVBQUUsVUFBQyxHQUFHLEVBQUUsZ0JBQWdCO1lBQ2xELEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7Z0JBQ04sUUFBUSxDQUFDLEdBQUcsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO2dCQUNoQyxNQUFNLENBQUM7WUFDWCxDQUFDO1lBRUQsSUFBSSxJQUFJLEdBQUcsSUFBSSxJQUFJLENBQUMsS0FBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQ2xDLElBQUksQ0FBQyxRQUFRLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxJQUFJLENBQ2hDLFVBQUMsT0FBTztnQkFDSixRQUFRLENBQUMsSUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUNqQyxDQUFDLEVBQ0QsVUFBQyxLQUFLO2dCQUNGLFFBQVEsQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUM7WUFDMUIsQ0FBQyxDQUFDLENBQUM7UUFDWCxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUM7SUFDTCx1QkFBQztBQUFELENBeENBLEFBd0NDLENBeENxQyxpQ0FBaUIsR0F3Q3REO0FBeENZLDRDQUFnQiIsImZpbGUiOiJjbGFzc2lmeS9wcm9jZXNzb3JzL3N2Z1Byb2Nlc3Nvci5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiJDOlxcQkFcXDQxN1xccyJ9
|
|
@ -1,106 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var gutil = require("gulp-util");
|
||||
var through2 = require("through2");
|
||||
var fs = require("fs");
|
||||
var Vinyl = require("vinyl");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-manifest-resource';
|
||||
function gulpManifestResources(options) {
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
return pError;
|
||||
}
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// resource name.
|
||||
// resourceName: string;
|
||||
//
|
||||
// path of manifest file.
|
||||
// manifest: string;
|
||||
//
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({
|
||||
manifest: 'src/manifest.json'
|
||||
}, options || {});
|
||||
var resourceManifest = options.resourceName + '_Manifest_';
|
||||
var resources = {};
|
||||
return through2.obj(
|
||||
/**
|
||||
* @this {Transform}
|
||||
*/
|
||||
function (file, encoding, callback) {
|
||||
var locale = 'default';
|
||||
if (resources.default) {
|
||||
var pathSegments = file.history[0].split('\\');
|
||||
locale = pathSegments[pathSegments.length - 3];
|
||||
}
|
||||
resources[locale] = {};
|
||||
if (resources.default) {
|
||||
for (var resourceId in resources.default) {
|
||||
if (resources.default.hasOwnProperty(resourceId)) {
|
||||
resources[locale][resourceId] = resources.default[resourceId];
|
||||
}
|
||||
}
|
||||
}
|
||||
var object = JSON.parse(file.contents.toString());
|
||||
for (var name in object) {
|
||||
var index = name.indexOf(resourceManifest);
|
||||
if (index === 0) {
|
||||
var value = object[name];
|
||||
var resourceId_1 = name.substr(resourceManifest.length);
|
||||
// console.log(locale + '.' + resourceId + ': ' + value);
|
||||
resources[locale][resourceId_1] = value;
|
||||
}
|
||||
}
|
||||
return callback();
|
||||
},
|
||||
/**
|
||||
* @this {Flush}
|
||||
*/
|
||||
function (callback) {
|
||||
try {
|
||||
var manifestObject = JSON.parse(fs.readFileSync(options.manifest, 'utf8'));
|
||||
var locales = [];
|
||||
for (var locale in resources) {
|
||||
if (resources.hasOwnProperty(locale) && locale !== 'default') {
|
||||
locales.push(locale);
|
||||
}
|
||||
}
|
||||
locales.sort();
|
||||
locales.unshift('default');
|
||||
var formattedResources = [];
|
||||
for (var _i = 0, locales_1 = locales; _i < locales_1.length; _i++) {
|
||||
var locale = locales_1[_i];
|
||||
formattedResources.push({
|
||||
locale: locale,
|
||||
strings: resources[locale]
|
||||
});
|
||||
}
|
||||
manifestObject.resources = formattedResources;
|
||||
var manifestFile = new Vinyl({
|
||||
cwd: './',
|
||||
path: options.manifest,
|
||||
contents: new Buffer(JSON.stringify(manifestObject, null, 2))
|
||||
});
|
||||
this.push(manifestFile);
|
||||
}
|
||||
catch (e) {
|
||||
var error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
gutil.log(error);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
;
|
||||
module.exports = gulpManifestResources;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9ndWxwcy9ndWxwLW1hbmlmZXN0LXJlc291cmNlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFvQjtBQUNwQixZQUFZLENBQUM7O0FBQ2IsaUNBQW9DO0FBQ3BDLG1DQUFzQztBQUN0Qyx1QkFBMEI7QUFDMUIsNkJBQWdDO0FBRWhDLElBQUksV0FBVyxHQUFHLEtBQUssQ0FBQyxXQUFXLENBQUM7QUFDcEMsSUFBSSxXQUFXLEdBQUcsd0JBQXdCLENBQUM7QUFFM0MsK0JBQStCLE9BQU87SUFDckMscUJBQXFCLE1BQU0sRUFBRSxLQUFLO1FBQ2pDLEVBQUUsQ0FBQyxDQUFDLEtBQUssSUFBSSxDQUFDLE9BQU8sS0FBSyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUMxQyxDQUFDLE1BQU0sRUFBRSxPQUFPLENBQUMsQ0FBQyxPQUFPLENBQUMsVUFBVSxRQUFRO2dCQUMzQyxFQUFFLENBQUMsQ0FBQyxRQUFRLElBQUksS0FBSyxDQUFDLENBQ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R0FBRyxFQUFFLElBQUk7Z0JBQ1QsSUFBSSxFQUFFLE9BQU8sQ0FBQyxRQUFRO2dCQUN0QixRQUFRLEVBQUUsSUFBSSxNQUFNLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxjQUFjLEVBQUUsSUFBSSxFQUFFLENBQUMsQ0FBQyxDQUFDO2FBQ2hFLENBQUMsQ0FBQztZQUNILElBQUksQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUM7UUFDNUIsQ0FBQztRQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDVCxJQUFJLEtBQUssR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLENBQUMsQ0FBQyxNQUFNLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsV0FBVyxDQUFDLElBQUksV0FBVyxDQUFDLFdBQVcsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUNwSCxLQUFLLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ3JCLENBQUM7UUFFRCxRQUFRLEVBQUUsQ0FBQztJQUNmLENBQUMsQ0FBQyxDQUFDO0FBRVgsQ0FBQztBQUFBLENBQUM7QUFFRixNQUFNLENBQUMsT0FBTyxHQUFHLHFCQUFxQixDQUFDIiwiZmlsZSI6Imd1bHBzL2d1bHAtbWFuaWZlc3QtcmVzb3VyY2UvaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,61 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var through2 = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var Path = require("path");
|
||||
var Vinyl = require("vinyl");
|
||||
var PsCode = require("./ps-code-convert");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-ps-code';
|
||||
/**
|
||||
* Plugin level function
|
||||
*/
|
||||
function gulpPsCode() {
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
return pError;
|
||||
}
|
||||
var collection = {};
|
||||
var lastFile = null;
|
||||
return through2.obj(function (file, enc, cb) {
|
||||
var error = null;
|
||||
try {
|
||||
var path = Path.parse(file.path);
|
||||
if (path.ext === '.ps1') {
|
||||
if (collection[path.base]) {
|
||||
throw new Error('gulp-ps-code requires unique name of ps file, conflicted with ' + path.base);
|
||||
}
|
||||
var data = file.contents.toString('utf8');
|
||||
collection[path.base] = data;
|
||||
lastFile = file;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
return cb(error);
|
||||
}, function (cb) {
|
||||
var converter = new PsCode.PsCodeConverter();
|
||||
converter.contentReset();
|
||||
converter.generate(collection);
|
||||
var tsFile = new Vinyl({
|
||||
cwd: lastFile.cwd,
|
||||
base: lastFile.base,
|
||||
path: lastFile.base + '/powershell-scripts.ts',
|
||||
contents: new Buffer(converter.outputTs)
|
||||
});
|
||||
this.push(tsFile);
|
||||
console.log(tsFile.path);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
module.exports = gulpPsCode;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9ndWxwcy9ndWxwLXBzLWNvZGUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ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QUFDO1FBRS9CLElBQUksTUFBTSxHQUFHLElBQUksS0FBSyxDQUFDO1lBQ3RCLEdBQUcsRUFBRSxRQUFRLENBQUMsR0FBRztZQUNqQixJQUFJLEVBQUUsUUFBUSxDQUFDLElBQUk7WUFDbkIsSUFBSSxFQUFFLFFBQVEsQ0FBQyxJQUFJLEdBQUcsd0JBQXdCO1lBQzlDLFFBQVEsRUFBRSxJQUFJLE1BQU0sQ0FBQyxTQUFTLENBQUMsUUFBUSxDQUFDO1NBQ3hDLENBQUMsQ0FBQztRQUNILElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7UUFDbEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDekIsRUFBRSxFQUFFLENBQUM7SUFDTixDQUFDLENBQUMsQ0FBQztBQUNMLENBQUM7QUFFRCxNQUFNLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQyIsImZpbGUiOiJndWxwcy9ndWxwLXBzLWNvZGUvaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,26 +0,0 @@
|
|||
export interface Options {
|
||||
noComments: boolean;
|
||||
}
|
||||
export declare class PsCodeConverter {
|
||||
private options;
|
||||
private static removeCommentsTrue;
|
||||
private static removeCommentsFalse;
|
||||
private static commentStart;
|
||||
private static commentEnd;
|
||||
private static comment;
|
||||
private static openContent;
|
||||
private static closeContent;
|
||||
outputTs: string;
|
||||
contentReset(): void;
|
||||
private contentAddTs(line);
|
||||
private indent(count);
|
||||
constructor(options?: Options);
|
||||
generate(collection: {
|
||||
[index: string]: string;
|
||||
}): void;
|
||||
private jsonName(original);
|
||||
private regexEscape(str);
|
||||
private replaceAll(input, searchValue, replaceValue);
|
||||
private addToContent(name, script, indent);
|
||||
private addData(current);
|
||||
}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,84 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Through = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var Path = require("path");
|
||||
var Resjson = require("./resjson-convert");
|
||||
var Vinyl = require("vinyl");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-resjson';
|
||||
module.exports = function (options) {
|
||||
//
|
||||
// (Options):
|
||||
//
|
||||
// enable to produce xxxx.d.ts file.
|
||||
// definition: string; { null, 'module' }
|
||||
//
|
||||
// enable to produce xxxx.ts file.
|
||||
// typescript: string; { null, 'module', 'interface' }
|
||||
//
|
||||
// enable to produce xxxx.json file.
|
||||
// json: boolean;
|
||||
//
|
||||
// if set a space charactors, it adds formating of JSON.
|
||||
// it set null, space will be eliminated.
|
||||
// jsonSpace: string | number;
|
||||
//
|
||||
// override options settings if not specified.
|
||||
options = Object.assign({ definition: null, typescript: null, json: false, jsonSpace: null }, options || {});
|
||||
/**
|
||||
* @this {Transform}
|
||||
*/
|
||||
var transform = function (file, encoding, callback) {
|
||||
if (file.isNull()) {
|
||||
// nothing to do
|
||||
return callback(null, file);
|
||||
}
|
||||
if (file.isStream()) {
|
||||
// file.contents is a Stream - https://nodejs.org/api/stream.html
|
||||
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'));
|
||||
return callback(null, file);
|
||||
}
|
||||
else if (file.isBuffer()) {
|
||||
var data = file.contents.toString('utf8');
|
||||
var converter = new Resjson.ResJsonConverter(options);
|
||||
converter.convert(data);
|
||||
var path = Path.parse(file.path);
|
||||
if (options.definition) {
|
||||
var dtFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: path.dir,
|
||||
path: path.dir + '/' + path.name + '.d.ts',
|
||||
contents: new Buffer(converter.outputDt)
|
||||
});
|
||||
this.push(dtFile);
|
||||
}
|
||||
if (options.typescript) {
|
||||
var content = options.typescript === 'interface' ? converter.outputInterface : converter.outputTs;
|
||||
var tsFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: path.dir,
|
||||
path: path.dir + '/' + path.name + '.ts',
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
this.push(tsFile);
|
||||
}
|
||||
if (options.json) {
|
||||
var base = options.srcRoot || path.dir;
|
||||
var content = JSON.stringify(converter.outputJson, null, options.jsonSpace);
|
||||
var jsonFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: base,
|
||||
path: path.dir + '\\' + path.name + '.json',
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
this.push(jsonFile);
|
||||
}
|
||||
}
|
||||
callback();
|
||||
};
|
||||
return Through.obj(transform);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9ndWxwcy9ndWxwLXJlc2pzb24vaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ3BCLFlBQVksQ0FBQzs7QUFDYixrQ0FBcUM7QUFDckMsaUNBQW9DO0FBQ3BDLDJCQUE4QjtBQUM5QiwyQ0FBOEM7QUFDOUMsNkJBQWdDO0FBRWhDLElBQUksV0FBVyxHQUFHLEtBQUssQ0FBQyxXQUFXLENBQUM7QUFDcEMsSUFBSSxXQUFXLEdBQUcsY0FBYyxDQUFDO0FBRWpDLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxPQUFPO0lBQzlCLEVBQUU7SUFDRixhQUFhO0lBQ2IsRUFBRTtJQUNGLG9DQUFvQztJQUNwQywyQ0FBMkM7SUFDM0MsRUFBRTtJQUNGLGtDQUFrQztJQUNsQyx3REFBd0Q7SUFDeEQsRUFBRTtJQUNGLG9DQUFvQztJQUNwQyxtQkFBbUI7SUFDbkIsRUFBRTtJQUNGLHdEQUF3RDtJQUN4RCx5Q0FBeUM7SUFDekMsZ0NBQWdDO0lBQ2hDLEVBQUU7SUFF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ean;
|
||||
jsonSpace: string | number;
|
||||
}
|
||||
export declare class ResJsonConverter {
|
||||
private options;
|
||||
outputDt: string;
|
||||
outputTs: string;
|
||||
outputInterface: string;
|
||||
outputJson: any;
|
||||
private jsonCurrent;
|
||||
private contentReset();
|
||||
private contentAddDt(line);
|
||||
private contentAddTs(line);
|
||||
private contentAddIt(line);
|
||||
private jsonNewValue(name);
|
||||
private jsonAddValue(name, value);
|
||||
private scan(node);
|
||||
private traverse(keyItems, indent);
|
||||
constructor(options: Options);
|
||||
convert(content: string): void;
|
||||
}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,81 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var through2 = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var Path = require("path");
|
||||
var Vinyl = require("vinyl");
|
||||
var SvgCode = require("./svg-code-convert");
|
||||
var PluginError = gutil.PluginError;
|
||||
var PLUGIN_NAME = 'gulp-svg-code';
|
||||
/**
|
||||
* Plugin level function
|
||||
*/
|
||||
function gulpSvgCode() {
|
||||
function extendError(pError, error) {
|
||||
if (error && (typeof error === 'object')) {
|
||||
['name', 'errno'].forEach(function (property) {
|
||||
if (property in error) {
|
||||
this[property] = error[property];
|
||||
}
|
||||
}, pError);
|
||||
}
|
||||
return pError;
|
||||
}
|
||||
var pathPrefix = null;
|
||||
var collection = {};
|
||||
return through2.obj(function (file, enc, cb) {
|
||||
var error = null;
|
||||
try {
|
||||
var path = Path.parse(file.path);
|
||||
if (path.ext === '.svg') {
|
||||
if (pathPrefix === null) {
|
||||
pathPrefix = path.dir;
|
||||
}
|
||||
else {
|
||||
var segments = path.dir.split('\\');
|
||||
var segPrefix = pathPrefix.split('\\');
|
||||
var newPrefix = [];
|
||||
for (var i = 0; i < segPrefix.length; i++) {
|
||||
if (segments[i].toLocaleUpperCase() !== segPrefix[i].toLocaleUpperCase()) {
|
||||
pathPrefix = newPrefix.join('\\');
|
||||
break;
|
||||
}
|
||||
newPrefix.push(segments[i]);
|
||||
}
|
||||
}
|
||||
var data = file.contents.toString('utf8');
|
||||
collection[file.path] = data;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
|
||||
}
|
||||
return cb(error);
|
||||
}, function (cb) {
|
||||
console.log(pathPrefix);
|
||||
var converter = new SvgCode.SvgCodeConverter();
|
||||
converter.contentReset();
|
||||
converter.generate(collection, pathPrefix);
|
||||
var cssFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: pathPrefix,
|
||||
path: pathPrefix + '\\svg.css',
|
||||
contents: new Buffer(converter.outputCss)
|
||||
});
|
||||
this.push(cssFile);
|
||||
console.log(cssFile.path);
|
||||
var tsFile = new Vinyl({
|
||||
cwd: '/',
|
||||
base: pathPrefix,
|
||||
path: pathPrefix + '\\svg.ts',
|
||||
contents: new Buffer(converter.outputTs)
|
||||
});
|
||||
this.push(tsFile);
|
||||
console.log(tsFile.path);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
module.exports = gulpSvgCode;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9ndWxwcy9ndWxwLXN2Zy1jb2RlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFvQjtBQUNwQixZQUFZLENBQUM7O0FBRWIsbUNBQXNDO0FBQ3RDLGlDQUFvQztBQUNwQywyQkFBOEI7QUFDOUIsNkJBQWdDO0FBQ2hDLDRDQUErQztBQUUvQyxJQUFJLFdBQVcsR0FBRyxLQUFLLENBQUMsV0FBVyxDQUFDO0FBQ3BDLElBQUksV0FBVyxHQUFHLGVBQWUsQ0FBQztBQUVsQzs7R0FFRztBQUNIO0lBQ0MscUJBQXFCLE1BQU0sRUFBRSxLQUF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DQUFDO1FBQ0gsSUFBSSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUNsQixPQUFPLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUN6QixFQUFFLEVBQUUsQ0FBQztJQUNOLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQUVELE1BQU0sQ0FBQyxPQUFPLEdBQUcsV0FBVyxDQUFDIiwiZmlsZSI6Imd1bHBzL2d1bHAtc3ZnLWNvZGUvaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,15 +0,0 @@
|
|||
export declare class SvgCodeConverter {
|
||||
outputCss: string;
|
||||
outputTs: string;
|
||||
contentReset(): void;
|
||||
private contentAddCss(line);
|
||||
private contentAddTs(line);
|
||||
private indent(count);
|
||||
generate(collection: {
|
||||
[index: string]: any;
|
||||
}, pathPrefix: string): void;
|
||||
private addData(current, segments);
|
||||
private createStructure(collection, pathPrefix);
|
||||
private regexEscape(str);
|
||||
private replaceAll(input, searchValue, replaceValue);
|
||||
}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,43 +0,0 @@
|
|||
/* tslint:disable */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var gutil = require("gulp-util");
|
||||
var util = require("../util/util");
|
||||
var PLUGIN_NAME = 'gulp-sme-help';
|
||||
var helpformat = "Gulpfile {0}...\n\nUSAGE\ngulp [TASK] [OPTIONS]\n\nTASKS:\n{1}\n";
|
||||
var taskformat = "\n {0} \n {1}{2}\n";
|
||||
var argsformat = "\n{0}";
|
||||
var argformat = "\n {0} : {1}";
|
||||
function newline() {
|
||||
console.log('');
|
||||
}
|
||||
function help(options) {
|
||||
if (!options) {
|
||||
throw util.toGulpError(PLUGIN_NAME, 'required parameter "options" null or undefined.');
|
||||
}
|
||||
var tasks = '';
|
||||
var keys = Object.keys(options);
|
||||
keys.forEach(function (taskName) {
|
||||
var task = options[taskName];
|
||||
var argsText = '';
|
||||
if (!task) {
|
||||
task = gutil.colors.magenta('This task is not documented');
|
||||
}
|
||||
if (!util.isString(task)) {
|
||||
if (task.arguments) {
|
||||
var args_1 = '';
|
||||
var argKeys = Object.keys(task.arguments);
|
||||
argKeys.forEach(function (arg) {
|
||||
args_1 += util.format(argformat, gutil.colors.green(util.format('--{0}', arg)), task.arguments[arg]);
|
||||
});
|
||||
argsText += util.format(argsformat, args_1);
|
||||
}
|
||||
task = task.comment;
|
||||
}
|
||||
tasks += util.format(taskformat, gutil.colors.cyan(taskName), task, argsText);
|
||||
});
|
||||
util.log(util.format(helpformat, gutil.colors.cyan('HELP!'), tasks));
|
||||
}
|
||||
module.exports = help;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9oZWxwL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFvQjtBQUNwQixZQUFZLENBQUM7O0FBR2IsaUNBQW9DO0FBQ3BDLG1DQUFzQztBQUV0QyxJQUFNLFdBQVcsR0FBRyxlQUFlLENBQUM7QUFDcEMsSUFBSSxVQUFVLEdBQUcsa0VBT2hCLENBQUM7QUFDRixJQUFJLFVBQVUsR0FBRyxnQ0FHaEIsQ0FBQztBQUNGLElBQUksVUFBVSxHQUFHLE9BQ2IsQ0FBQztBQUNMLElBQUksU0FBUyxHQUFHLHFCQUNFLENBQUM7QUFFbkI7SUFDSSxPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBQ3BCLENBQUM7QUFFRCxjQUFjLE9BQVk7SUFDdEIsRUFBRSxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1FBQ1gsTUFBTSxJQUFJLENBQUMsV0FBVyxDQUFDLF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0RyxDQUFDLENBQUMsQ0FBQztnQkFFSCxRQUFRLElBQUksSUFBSSxDQUFDLE1BQU0sQ0FBQyxVQUFVLEVBQUUsTUFBSSxDQUFDLENBQUM7WUFFOUMsQ0FBQztZQUNELElBQUksR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDO1FBQ3hCLENBQUM7UUFFRCxLQUFLLElBQUksSUFBSSxDQUFDLE1BQU0sQ0FBQyxVQUFVLEVBQUUsS0FBSyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLEVBQUUsSUFBSSxFQUFFLFFBQVEsQ0FBQyxDQUFDO0lBQ2xGLENBQUMsQ0FBQyxDQUFDO0lBRUgsSUFBSSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLFVBQVUsRUFBRSxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsRUFBRSxLQUFLLENBQUMsQ0FBQyxDQUFDO0FBQ3pFLENBQUM7QUFFRCxNQUFNLENBQUMsT0FBTyxHQUFHLElBQUksQ0FBQyIsImZpbGUiOiJoZWxwL2luZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* Recursively merges JSON files with the same name and same subPath from the sourceFolders into the JSON files
|
||||
* in the targetFolderPath.
|
||||
*
|
||||
* @example
|
||||
* src/assets/resources/strings/ <- targetFolderPath
|
||||
* strings.json
|
||||
* es/strings.json
|
||||
* pt/strings.json
|
||||
* [
|
||||
* 'node_modules/@msft-sme/core/dist/assets/resources/strings',
|
||||
* 'node_modules/@msft-sme/ng2/dist/assets/resources/strings'
|
||||
* ] <- sourceFoldersPath
|
||||
*
|
||||
* src/assets/resources/strings/strings.json contents are merged with the contents of
|
||||
* node_modules/@msft-sme/core/dist/assets/resources/strings/strings.json and
|
||||
* node_modules/@msft-ng2/core/dist/assets/resources/strings/strings.json
|
||||
* and the source file is overwritten by the merged content
|
||||
*
|
||||
* @param targetFolderPathRoot {string} The path of the base folder where the destination files are placed.
|
||||
* @param sourceFoldersPathRoot {string[]} The array of paths to the source folders from where to read the JSON files to merge
|
||||
*/
|
||||
export declare function mergeJsonInFolders(targetFolderPathRoot: string, sourceFoldersPathRoot: string[]): void;
|
|
@ -1,60 +0,0 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util = require("../util/util");
|
||||
/**
|
||||
* Recursively merges JSON files with the same name and same subPath from the sourceFolders into the JSON files
|
||||
* in the targetFolderPath.
|
||||
*
|
||||
* @example
|
||||
* src/assets/resources/strings/ <- targetFolderPath
|
||||
* strings.json
|
||||
* es/strings.json
|
||||
* pt/strings.json
|
||||
* [
|
||||
* 'node_modules/@msft-sme/core/dist/assets/resources/strings',
|
||||
* 'node_modules/@msft-sme/ng2/dist/assets/resources/strings'
|
||||
* ] <- sourceFoldersPath
|
||||
*
|
||||
* src/assets/resources/strings/strings.json contents are merged with the contents of
|
||||
* node_modules/@msft-sme/core/dist/assets/resources/strings/strings.json and
|
||||
* node_modules/@msft-ng2/core/dist/assets/resources/strings/strings.json
|
||||
* and the source file is overwritten by the merged content
|
||||
*
|
||||
* @param targetFolderPathRoot {string} The path of the base folder where the destination files are placed.
|
||||
* @param sourceFoldersPathRoot {string[]} The array of paths to the source folders from where to read the JSON files to merge
|
||||
*/
|
||||
function mergeJsonInFolders(targetFolderPathRoot, sourceFoldersPathRoot) {
|
||||
var targetFilesContentMap = {};
|
||||
// ensurePathExists expects an actual file path to build the folder path
|
||||
util.ensurePathExists(targetFolderPathRoot + '/aFile.json');
|
||||
var targetFiles = util.getFilePaths(targetFolderPathRoot);
|
||||
targetFiles.forEach(function (targetFile) {
|
||||
var relativePath = targetFile.substring(targetFolderPathRoot.length + 1, targetFile.length);
|
||||
targetFilesContentMap[relativePath] = util.readJSON(targetFile);
|
||||
});
|
||||
sourceFoldersPathRoot.forEach(function (sourceFolderPathRoot) {
|
||||
var sourceFiles = util.getFilePaths(sourceFolderPathRoot);
|
||||
sourceFiles.forEach(function (sourceFile) {
|
||||
var relativePath = sourceFile.substring(sourceFolderPathRoot.length + 1, sourceFile.length);
|
||||
var sourceJson = util.readJSON(sourceFile);
|
||||
mergeJsons(relativePath, sourceJson, targetFilesContentMap);
|
||||
});
|
||||
});
|
||||
// tslint:disable-next-line:forin
|
||||
for (var path in targetFilesContentMap) {
|
||||
var targetFilePath = targetFolderPathRoot + '/' + path;
|
||||
util.ensurePathExists(targetFilePath);
|
||||
util.writeJsonNoSpace(targetFilePath, targetFilesContentMap[path]);
|
||||
}
|
||||
}
|
||||
exports.mergeJsonInFolders = mergeJsonInFolders;
|
||||
function mergeJsons(relativePath, sourceJson, targetFilesContentMap) {
|
||||
if (targetFilesContentMap[relativePath]) {
|
||||
util.extend(targetFilesContentMap[relativePath], [sourceJson]);
|
||||
}
|
||||
else {
|
||||
targetFilesContentMap[relativePath] = sourceJson;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9qc29uLW1lcmdlL2pzb24tbWVyZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsWUFBWSxDQUFDOztBQUViLG1DQUFzQztBQUN0Qzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUJHO0FBQ0gsNEJBQW1DLG9CQUE0QixFQUFFLHFCQUErQjtJQUM1RixJQUFJLHFCQUFxQixHQUFHLEVBQUUsQ0FBQztJQUMvQix3RUFBd0U7SUFDeEUsSUFBSSxDQUFDLGdCQUFnQixDQUFDLG9CQUFvQixHQUFHLGFBQWEsQ0FBQyxDQUFDO0lBQzVELElBQUksV0FBVyxHQUFHLElBQUksQ0FBQyxZQUFZLENBQUMsb0JBQW9CLENBQUMsQ0FBQztJQUMxRC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QkFBZ0IsQ0FBQyxjQUFjLEVBQUUscUJBQXFCLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztJQUN2RSxDQUFDO0FBQ0wsQ0FBQztBQTNCRCxnREEyQkM7QUFFRCxvQkFBb0IsWUFBb0IsRUFBRSxVQUFlLEVBQUUscUJBQXlCO0lBQ2hGLEVBQUUsQ0FBQyxDQUFDLHFCQUFxQixDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUN0QyxJQUFJLENBQUMsTUFBTSxDQUFDLHFCQUFxQixDQUFDLFlBQVksQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQztJQUNuRSxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixxQkFBcUIsQ0FBQyxZQUFZLENBQUMsR0FBRyxVQUFVLENBQUM7SUFDckQsQ0FBQztBQUNMLENBQUMiLCJmaWxlIjoianNvbi1tZXJnZS9qc29uLW1lcmdlLmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,13 +0,0 @@
|
|||
export import classify = require('./classify');
|
||||
export import classifyGenerators = require('./classify/generators');
|
||||
export import classifyProcessors = require('./classify/processors');
|
||||
export import help = require('./help');
|
||||
export import jsonMerge = require('./json-merge/json-merge');
|
||||
export import ng2 = require('./ng2/ng2');
|
||||
export import npm = require('./npm/npm');
|
||||
export import sme = require('./sme');
|
||||
export import util = require('./util/util');
|
||||
export import vsts = require('./vsts');
|
||||
export declare const svgCode: any;
|
||||
export declare const psCode: any;
|
||||
export declare const resjson: any;
|
|
@ -1,18 +0,0 @@
|
|||
"use strict";
|
||||
// any publicly exposed modules should be exported here
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.classify = require("./classify");
|
||||
exports.classifyGenerators = require("./classify/generators");
|
||||
exports.classifyProcessors = require("./classify/processors");
|
||||
exports.help = require("./help");
|
||||
exports.jsonMerge = require("./json-merge/json-merge");
|
||||
exports.ng2 = require("./ng2/ng2");
|
||||
exports.npm = require("./npm/npm");
|
||||
exports.sme = require("./sme");
|
||||
exports.util = require("./util/util");
|
||||
exports.vsts = require("./vsts");
|
||||
exports.svgCode = require('./gulps/gulp-svg-code');
|
||||
exports.psCode = require('./gulps/gulp-ps-code');
|
||||
exports.resjson = require('./gulps/gulp-resjson');
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1REFBdUQ7O0FBRXZELHlDQUErQztBQUMvQyw4REFBb0U7QUFDcEUsOERBQW9FO0FBQ3BFLGlDQUF1QztBQUN2Qyx1REFBNkQ7QUFDN0QsbUNBQXlDO0FBQ3pDLG1DQUF5QztBQUN6QywrQkFBcUM7QUFDckMsc0NBQTRDO0FBQzVDLGlDQUF1QztBQUMxQixRQUFBLE9BQU8sR0FBRyxPQUFPLENBQUMsdUJBQXVCLENBQUMsQ0FBQztBQUMzQyxRQUFBLE1BQU0sR0FBRyxPQUFPLENBQUMsc0JBQXNCLENBQUMsQ0FBQztBQUN6QyxRQUFBLE9BQU8sR0FBRyxPQUFPLENBQUMsc0JBQXNCLENBQUMsQ0FBQyIsImZpbGUiOiJtYWluLmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,4 +0,0 @@
|
|||
import util = require('../util/util');
|
||||
export declare function build(done: util.GulpDoneFunction): void;
|
||||
export declare function buildAot(done: util.GulpDoneFunction): void;
|
||||
export declare function serve(done: util.GulpDoneFunction): void;
|
|
@ -1,42 +0,0 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var child_process = require("child_process");
|
||||
var gutil = require("gulp-util");
|
||||
var util = require("../util/util");
|
||||
var PLUGIN_NAME = 'gulp-sme-ng2';
|
||||
function getArguments() {
|
||||
return process.argv.slice(2);
|
||||
}
|
||||
function spawnNgCommand(command, args, cb) {
|
||||
gutil.log('ng command', args);
|
||||
args.unshift(command);
|
||||
var cmd = child_process.spawn('ng.cmd', args);
|
||||
cmd.stdout.on('data', function (data) {
|
||||
gutil.log(data.toString());
|
||||
});
|
||||
cmd.stderr.on('data', function (data) {
|
||||
gutil.log(data.toString());
|
||||
});
|
||||
cmd.on('exit', function (code) {
|
||||
if (code > 0) {
|
||||
var message = util.format('"ng {0}" exited with code {1}.', args.join(' '), gutil.colors.cyan(code.toString()));
|
||||
cb(util.toGulpError(PLUGIN_NAME, message));
|
||||
return;
|
||||
}
|
||||
cb();
|
||||
});
|
||||
}
|
||||
function build(done) {
|
||||
spawnNgCommand('build', getArguments().concat('--aot=false'), done);
|
||||
}
|
||||
exports.build = build;
|
||||
function buildAot(done) {
|
||||
spawnNgCommand('build', getArguments().concat('--aot=true'), done);
|
||||
}
|
||||
exports.buildAot = buildAot;
|
||||
function serve(done) {
|
||||
spawnNgCommand('serve', getArguments(), done);
|
||||
}
|
||||
exports.serve = serve;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9uZzIvbmcyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFlBQVksQ0FBQzs7QUFDYiw2Q0FBZ0Q7QUFDaEQsaUNBQW9DO0FBR3BDLG1DQUFzQztBQUV0QyxJQUFNLFdBQVcsR0FBRyxjQUFjLENBQUM7QUFFbkM7SUFDSSxNQUFNLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDakMsQ0FBQztBQUVELHdCQUF3QixPQUFlLEVBQUUsSUFBYyxFQUFFLEVBQXlCO0lBQzlFLEtBQUssQ0FBQyxHQUFHLENBQUMsWUFBWS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M7QUFDUCxDQUFDO0FBRUQsZUFBc0IsSUFBMkI7SUFDN0MsY0FBYyxDQUFDLE9BQU8sRUFBRSxZQUFZLEVBQUUsQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFDLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDeEUsQ0FBQztBQUZELHNCQUVDO0FBRUQsa0JBQXlCLElBQTJCO0lBQ2hELGNBQWMsQ0FBQyxPQUFPLEVBQUUsWUFBWSxFQUFFLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQyxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQ3ZFLENBQUM7QUFGRCw0QkFFQztBQUVELGVBQXNCLElBQTJCO0lBQzdDLGNBQWMsQ0FBQyxPQUFPLEVBQUUsWUFBWSxFQUFFLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDbEQsQ0FBQztBQUZELHNCQUVDIiwiZmlsZSI6Im5nMi9uZzIuanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,27 +0,0 @@
|
|||
import util = require('../util/util');
|
||||
export interface PublishOptions {
|
||||
version: string;
|
||||
tags: string[];
|
||||
}
|
||||
export interface NpmPackageDependencyMap {
|
||||
[key: string]: string;
|
||||
}
|
||||
export interface NpmPackage {
|
||||
name?: string;
|
||||
version?: string;
|
||||
dependencies?: NpmPackageDependencyMap;
|
||||
devDependencies?: NpmPackageDependencyMap;
|
||||
peerDependencies?: NpmPackageDependencyMap;
|
||||
optionalDependencies?: NpmPackageDependencyMap;
|
||||
private?: boolean;
|
||||
}
|
||||
export declare function readPackage(): NpmPackage;
|
||||
export declare function writePackage(pkg: any): void;
|
||||
export declare function update(done?: util.GulpDoneFunction): void;
|
||||
export declare function getTags(name: string, cb: (err: Error, tags?: {
|
||||
[key: string]: string;
|
||||
}) => void): void;
|
||||
export declare function getLatestVersion(name: string, cb: (err: Error, version?: string) => void): void;
|
||||
export declare function addTags(name: string, options: PublishOptions, cb: util.GulpDoneFunction): void;
|
||||
export declare function publish(confirm: boolean, options: PublishOptions, callback: util.GulpDoneFunction): void;
|
||||
export declare function validateDependencies(pkg: NpmPackage, prod: boolean, callback: util.GulpDoneFunction): void;
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,40 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var npm = require("../npm/npm");
|
||||
var util = require("../util/util");
|
||||
var sme_1 = require("./sme");
|
||||
var SME = /** @class */ (function () {
|
||||
function SME() {
|
||||
// surface enums to gulp
|
||||
this.ProjectType = sme_1.ProjectType;
|
||||
}
|
||||
SME.prototype.init = function (isProd, projectType) {
|
||||
this.build = new sme_1.SMEBuild(isProd, projectType);
|
||||
};
|
||||
Object.defineProperty(SME.prototype, "isInitialized", {
|
||||
get: function () {
|
||||
return !!this.build;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
SME.prototype.validate = function (callback) {
|
||||
util.log("Starting sme.validate");
|
||||
var pkg = npm.readPackage();
|
||||
npm.validateDependencies(pkg, this.build.options.isProduction, callback);
|
||||
};
|
||||
SME.prototype.publish = function (confirm, callback, tags) {
|
||||
util.log("Starting sme.publish");
|
||||
util.log("confirm: " + confirm);
|
||||
util.log("tags: " + (tags ? tags.join(', ') : ''));
|
||||
this.build.publish(confirm, callback, tags);
|
||||
};
|
||||
SME.prototype.updateManifest = function (callback) {
|
||||
util.log("Starting sme.updateManifest");
|
||||
this.build.updateManifestForPublish(callback);
|
||||
};
|
||||
return SME;
|
||||
}());
|
||||
module.exports = new SME();
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9zbWUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxnQ0FBbUM7QUFDbkMsbUNBQXNDO0FBR3RDLDZCQU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QUUsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQ2hELENBQUM7SUFFTSw0QkFBYyxHQUFyQixVQUFzQixRQUErQjtRQUNqRCxJQUFJLENBQUMsR0FBRyxDQUFDLDZCQUE2QixDQUFDLENBQUM7UUFDeEMsSUFBSSxDQUFDLEtBQUssQ0FBQyx3QkFBd0IsQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUNsRCxDQUFDO0lBQ0wsVUFBQztBQUFELENBL0JBLEFBK0JDLElBQUE7QUFFRCxNQUFNLENBQUMsT0FBTyxHQUFHLElBQUksR0FBRyxFQUFFLENBQUMiLCJmaWxlIjoic21lL2luZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,73 +0,0 @@
|
|||
import npm = require('../npm/npm');
|
||||
import util = require('../util/util');
|
||||
export declare enum ReleaseMode {
|
||||
singleBranch = 0,
|
||||
multiReleaseBranch = 1,
|
||||
}
|
||||
export declare enum ProjectType {
|
||||
tslib = 0,
|
||||
nglib = 1,
|
||||
ngSmeModule = 2,
|
||||
}
|
||||
/**
|
||||
* Options specific to the SME Build architecture.
|
||||
*/
|
||||
export declare class SmeOptions {
|
||||
private isProductionInternal;
|
||||
private projectTypeInternal;
|
||||
constructor(isProd: boolean, projectType: ProjectType);
|
||||
/**
|
||||
* Indicates that the build being performed against a non-release branch
|
||||
*/
|
||||
readonly isProduction: boolean;
|
||||
/**
|
||||
* Flag to indicate that the type of project we are building
|
||||
*/
|
||||
readonly projectType: ProjectType;
|
||||
/**
|
||||
* Flag to indicate that the build is local
|
||||
*/
|
||||
readonly isLocal: boolean;
|
||||
/**
|
||||
* Flag to indicate that the build is not a release build, (therefore it is a dev build)
|
||||
*/
|
||||
readonly isDev: boolean;
|
||||
/**
|
||||
* Flag to indicate that the build being performed against a release branch and conditions have not been satisfied for a full release
|
||||
*/
|
||||
readonly isRC: boolean;
|
||||
/**
|
||||
* Flag to indicate that the build being performed against a release branch and conditions have been satisfied for a full release
|
||||
*/
|
||||
readonly isRelease: boolean;
|
||||
/**
|
||||
* The name of the release branch we are building against. Null if not on a release branch.
|
||||
*/
|
||||
readonly releaseBranchName: string;
|
||||
/**
|
||||
* Calculate if this build will result in a new latest package version being produced.
|
||||
* Returns true only in production release or RC build where the package.json version
|
||||
* is greater than the greatest release package version.
|
||||
*/
|
||||
getIsLatest(pkg: npm.NpmPackage, callback: (err: Error, isLatest: boolean) => void): void;
|
||||
/**
|
||||
* Gets the new options that this package will produce.
|
||||
*/
|
||||
getNewPublishOptions(pkg: npm.NpmPackage, callback: (err: Error, options: npm.PublishOptions) => void): void;
|
||||
}
|
||||
export declare class SMEBuild {
|
||||
optionsInternal: SmeOptions;
|
||||
constructor(isProd: boolean, projectType: ProjectType);
|
||||
readonly options: SmeOptions;
|
||||
/**
|
||||
* Reads the SME manifest or errors if it doesn't exist
|
||||
*/
|
||||
readManifest(): any;
|
||||
/**
|
||||
* Writes the SME manifest
|
||||
*/
|
||||
writeManifest(manifest: any): void;
|
||||
publish(confirm: boolean, callback: util.GulpDoneFunction, tags?: string[]): void;
|
||||
private preparePublish(pkg, callback);
|
||||
updateManifestForPublish(callback: util.GulpDoneFunction): void;
|
||||
}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,23 +0,0 @@
|
|||
import gutil = require('gulp-util');
|
||||
export declare function log(message: string): void;
|
||||
export declare function read(path: string, encoding?: string): string;
|
||||
export declare function readJSON(path: string): any;
|
||||
export declare function write(path: string, contents: string): void;
|
||||
export declare function writeJSON(path: string, json: any): void;
|
||||
export declare function writeJsonNoSpace(path: string, json: any): void;
|
||||
export declare function toGulpError(pError: gutil.PluginError | string, error: Error | string): gutil.PluginError;
|
||||
export interface GulpDoneFunction {
|
||||
(error?: Error): void;
|
||||
}
|
||||
export declare function noop(): void;
|
||||
export declare function isObject(value: any): boolean;
|
||||
export declare function isFunction(value: any): boolean;
|
||||
export declare function isString(value: any): boolean;
|
||||
export declare function extend(dest: any, sources: any[]): any;
|
||||
export declare function confirm(message: string, canceledMessage?: string, exit?: boolean): boolean;
|
||||
export declare function format(value: string, ...restArgs: any[]): any;
|
||||
export declare function pad(value: number | string, length: number, padChar?: string): string;
|
||||
export declare function getFilePaths(dir: any, paths?: string[]): string[];
|
||||
export declare function getSubFolders(dir: string): string[];
|
||||
export declare function ensurePathExists(filePath: any): boolean;
|
||||
export declare function exists(path: any): boolean;
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,41 +0,0 @@
|
|||
import { VSTSEnvironment } from '../vsts-environment';
|
||||
export declare class AgentEnvironment extends VSTSEnvironment {
|
||||
/**
|
||||
* Gets a vsts agent env variable
|
||||
* @param name the name of the env var to get
|
||||
*/
|
||||
protected get(name: string): string;
|
||||
/**
|
||||
* The local path on the agent where all folders for a given build definition are created.
|
||||
* For example: 'c:\agent\_work\1'
|
||||
*/
|
||||
readonly buildDirectory: string;
|
||||
/**
|
||||
* The directory the agent is installed into. This contains the agent software.
|
||||
* For example: 'c:\agent\'.
|
||||
*
|
||||
* If you are using an on-premises agent, this directory is specified by you.
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/agents/agents.
|
||||
*/
|
||||
readonly homeDirectory: string;
|
||||
/**
|
||||
* The ID of the agent.
|
||||
*/
|
||||
readonly id: string;
|
||||
/**
|
||||
* The name of the machine on which the agent is installed.
|
||||
*/
|
||||
readonly machineName: string;
|
||||
/**
|
||||
* The name of the agent that is registered with the pool.
|
||||
*
|
||||
* If you are using an on-premises agent, this directory is specified by you.
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/agents/agents.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* The working directory for this agent.
|
||||
* For example: 'c:\agent\_work'.
|
||||
*/
|
||||
readonly WorkFolder: string;
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var vsts_environment_1 = require("../vsts-environment");
|
||||
var AgentEnvironment = /** @class */ (function (_super) {
|
||||
__extends(AgentEnvironment, _super);
|
||||
function AgentEnvironment() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/**
|
||||
* Gets a vsts agent env variable
|
||||
* @param name the name of the env var to get
|
||||
*/
|
||||
AgentEnvironment.prototype.get = function (name) {
|
||||
return _super.prototype.get.call(this, "AGENT_" + name);
|
||||
};
|
||||
Object.defineProperty(AgentEnvironment.prototype, "buildDirectory", {
|
||||
/**
|
||||
* The local path on the agent where all folders for a given build definition are created.
|
||||
* For example: 'c:\agent\_work\1'
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('BUILDDIRECTORY');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(AgentEnvironment.prototype, "homeDirectory", {
|
||||
/**
|
||||
* The directory the agent is installed into. This contains the agent software.
|
||||
* For example: 'c:\agent\'.
|
||||
*
|
||||
* If you are using an on-premises agent, this directory is specified by you.
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/agents/agents.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('HOMEDIRECTORY');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(AgentEnvironment.prototype, "id", {
|
||||
/**
|
||||
* The ID of the agent.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('ID');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(AgentEnvironment.prototype, "machineName", {
|
||||
/**
|
||||
* The name of the machine on which the agent is installed.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('MACHINENAME');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(AgentEnvironment.prototype, "name", {
|
||||
/**
|
||||
* The name of the agent that is registered with the pool.
|
||||
*
|
||||
* If you are using an on-premises agent, this directory is specified by you.
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/agents/agents.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('NAME');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(AgentEnvironment.prototype, "WorkFolder", {
|
||||
/**
|
||||
* The working directory for this agent.
|
||||
* For example: 'c:\agent\_work'.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('WORKFOLDER');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return AgentEnvironment;
|
||||
}(vsts_environment_1.VSTSEnvironment));
|
||||
exports.AgentEnvironment = AgentEnvironment;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92c3RzL2Vudmlyb25tZW50L2FnZW50L2FnZW50LWVudmlyb25tZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLHdEQUFzRDtBQUV0RDtJQUFzQyxvQ0FBZTtJQUFyRDs7SUEyREEsQ0FBQztJQTFERzs7O09BR0c7SUFDTyw4QkFBRyxHQUFiLFVBQWMsSUFBWTtRQUN0QixNQUFNLENBQUMsaUJBQU0sR0FBRyxZQUFDLFdBQVMsSUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQU1ELHNCQUFXLDRDQUFjO1FBSnpCOzs7V0FHRzthQUNIO1lBQ0ksTUFBTS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
|
||||
import { BuildReason } from './build-reason';
|
||||
import { BuildRepositoryEnvironment } from './build-repository-environment';
|
||||
export declare class BuildEnvironment extends VSTSEnvironment {
|
||||
/**
|
||||
* The Build Repository Environment configuration
|
||||
*/
|
||||
readonly repository: BuildRepositoryEnvironment;
|
||||
/**
|
||||
* Gets a vsts build env variable
|
||||
* @param name the name of the env var to get
|
||||
*/
|
||||
protected get(name: string): string;
|
||||
/**
|
||||
* The local path on the agent where any artifacts are copied to before being pushed to their destination.
|
||||
* For example: 'c:\agent\_work\1\a'.
|
||||
*
|
||||
* A typical way to use this folder is to publish your build artifacts with the
|
||||
* 'Copy files' (https://www.visualstudio.com/en-us/docs/build/steps/utility/copy-files) and
|
||||
* 'Publish build artifacts' (https://www.visualstudio.com/en-us/docs/build/steps/utility/publish-build-artifacts) steps
|
||||
*
|
||||
* Note: This directory is purged before each new build, so you don't have to clean it up yourself.
|
||||
*
|
||||
* Build.ArtifactStagingDirectory and Build.StagingDirectory are interchangeable.
|
||||
*
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/definitions/build/artifacts
|
||||
*/
|
||||
readonly artifactStagingDirectory: string;
|
||||
/**
|
||||
* The ID of the record for the completed build.
|
||||
*/
|
||||
readonly id: string;
|
||||
/**
|
||||
* The name of the completed build.
|
||||
* You can specify the build number format that generates this
|
||||
* value on the General tab (https://www.visualstudio.com/en-us/docs/build/define/general)
|
||||
*
|
||||
* A typical use of this variable is to make it part of the label format,
|
||||
* which you specify on the repository tab (https://www.visualstudio.com/en-us/docs/build/define/repository).
|
||||
*
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail.
|
||||
*/
|
||||
readonly number: string;
|
||||
/**
|
||||
* The URI for the build.
|
||||
* For example: 'vstfs:///Build/Build/1430'.
|
||||
*/
|
||||
readonly uri: string;
|
||||
/**
|
||||
* The local path on the agent you can use as an output folder for compiled binaries.
|
||||
* For example: 'c:\agent\_work\1\b'.
|
||||
*
|
||||
* By default, new build definitions are not set up to clean this directory.
|
||||
* You can define your build to clean it up on the Repository tab (https://www.visualstudio.com/en-us/docs/build/define/repository).
|
||||
*/
|
||||
readonly binariesDirectory: string;
|
||||
/**
|
||||
* The name of the build definition.
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail.
|
||||
*/
|
||||
readonly definitionName: string;
|
||||
/**
|
||||
* The version of the build definition.
|
||||
*/
|
||||
readonly definitionVersion: string;
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail
|
||||
*/
|
||||
readonly queuedBy: string;
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
*/
|
||||
readonly queuedById: string;
|
||||
/**
|
||||
* The event that caused the build to run
|
||||
* See
|
||||
* - https://www.visualstudio.com/en-us/docs/build/define/triggers
|
||||
* - https://www.visualstudio.com/en-us/docs/git/branch-policies
|
||||
*/
|
||||
readonly reason: BuildReason;
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail
|
||||
*/
|
||||
readonly requestedFor: string;
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
*/
|
||||
readonly requestedForEmail: string;
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
*/
|
||||
readonly requestedForId: string;
|
||||
/**
|
||||
* The branch the build was queued for.
|
||||
*
|
||||
* Some examples:
|
||||
* - Git repo branch: 'refs/heads/master'
|
||||
* - Git repo pull request: 'refs/pull/1/merge'
|
||||
* - TFVC repo branch: '$/teamproject/main'
|
||||
* - TFVC repo gated check-in: 'Gated_2016-06-06_05.20.51.4369;username@live.com'
|
||||
* - TFVC repo shelveset build: 'myshelveset;username@live.com'
|
||||
*
|
||||
* When you use this variable in your build number format,
|
||||
* the forward slash characters (/) are replaced with underscore characters _).
|
||||
*
|
||||
* Note: In TFVC, if you are running a gated check-in build or manually building a shelveset,
|
||||
* you cannot use this variable in your build number format.
|
||||
*/
|
||||
readonly sourceBranch: string;
|
||||
/**
|
||||
* The name of the branch the build was queued for.
|
||||
* - Git repo branch or pull request: The last path segment in the ref.
|
||||
* For example, in 'refs/heads/master' this value is 'master'.
|
||||
* - TFVC repo branch: The last path segment in the root server path for the workspace.
|
||||
* For example in '$/teamproject/main' this value is 'main'.
|
||||
* - TFVC repo gated check-in or shelveset build is the name of the shelveset.
|
||||
* For example, 'Gated_2016-06-06_05.20.51.4369;username@live.com' or 'myshelveset;username@live.com'.
|
||||
*
|
||||
* Note: In TFVC, if you are running a gated check-in build or manually building a shelveset,
|
||||
* you cannot use this variable in your build number format.
|
||||
*/
|
||||
readonly sourceBranchName: string;
|
||||
/**
|
||||
* The local path on the agent where your source code files are downloaded.
|
||||
* For example: 'c:\agent\_work\1\s'
|
||||
*
|
||||
* By default, new build definitions update only the changed files.
|
||||
* You can modify how files are downloaded on the Repository tab.
|
||||
*
|
||||
* See https://www.visualstudio.com/en-us/docs/build/define/repository
|
||||
*/
|
||||
readonly SourcesDirectory: string;
|
||||
/**
|
||||
* The latest version control change that is included in this build.
|
||||
* - Git: The commit ID.
|
||||
* - TFVC: the changeset number.
|
||||
*/
|
||||
readonly SourceVersion: string;
|
||||
/**
|
||||
* The local path on the agent where any artifacts are copied to before being pushed to their destination.
|
||||
* For example: 'c:\agent\_work\1\a'.
|
||||
*
|
||||
* A typical way to use this folder is to publish your build artifacts with the
|
||||
* 'Copy files' (https://www.visualstudio.com/en-us/docs/build/steps/utility/copy-files) and
|
||||
* 'Publish build artifacts' (https://www.visualstudio.com/en-us/docs/build/steps/utility/publish-build-artifacts) steps
|
||||
*
|
||||
* Note: This directory is purged before each new build, so you don't have to clean it up yourself.
|
||||
*
|
||||
* Build.ArtifactStagingDirectory and Build.StagingDirectory are interchangeable.
|
||||
*
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/definitions/build/artifacts
|
||||
*/
|
||||
readonly StagingDirectory: string;
|
||||
}
|
|
@ -1,297 +0,0 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var vsts_environment_1 = require("../vsts-environment");
|
||||
var build_reason_1 = require("./build-reason");
|
||||
var build_repository_environment_1 = require("./build-repository-environment");
|
||||
var BuildEnvironment = /** @class */ (function (_super) {
|
||||
__extends(BuildEnvironment, _super);
|
||||
function BuildEnvironment() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
/**
|
||||
* The Build Repository Environment configuration
|
||||
*/
|
||||
_this.repository = new build_repository_environment_1.BuildRepositoryEnvironment();
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Gets a vsts build env variable
|
||||
* @param name the name of the env var to get
|
||||
*/
|
||||
BuildEnvironment.prototype.get = function (name) {
|
||||
return _super.prototype.get.call(this, "BUILD_" + name);
|
||||
};
|
||||
Object.defineProperty(BuildEnvironment.prototype, "artifactStagingDirectory", {
|
||||
/**
|
||||
* The local path on the agent where any artifacts are copied to before being pushed to their destination.
|
||||
* For example: 'c:\agent\_work\1\a'.
|
||||
*
|
||||
* A typical way to use this folder is to publish your build artifacts with the
|
||||
* 'Copy files' (https://www.visualstudio.com/en-us/docs/build/steps/utility/copy-files) and
|
||||
* 'Publish build artifacts' (https://www.visualstudio.com/en-us/docs/build/steps/utility/publish-build-artifacts) steps
|
||||
*
|
||||
* Note: This directory is purged before each new build, so you don't have to clean it up yourself.
|
||||
*
|
||||
* Build.ArtifactStagingDirectory and Build.StagingDirectory are interchangeable.
|
||||
*
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/definitions/build/artifacts
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('ARTIFACTSTAGINGDIRECTORY');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "id", {
|
||||
/**
|
||||
* The ID of the record for the completed build.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('BuildId');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "number", {
|
||||
/**
|
||||
* The name of the completed build.
|
||||
* You can specify the build number format that generates this
|
||||
* value on the General tab (https://www.visualstudio.com/en-us/docs/build/define/general)
|
||||
*
|
||||
* A typical use of this variable is to make it part of the label format,
|
||||
* which you specify on the repository tab (https://www.visualstudio.com/en-us/docs/build/define/repository).
|
||||
*
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('BUILDNUMBER');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "uri", {
|
||||
/**
|
||||
* The URI for the build.
|
||||
* For example: 'vstfs:///Build/Build/1430'.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('BUILDURI');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "binariesDirectory", {
|
||||
/**
|
||||
* The local path on the agent you can use as an output folder for compiled binaries.
|
||||
* For example: 'c:\agent\_work\1\b'.
|
||||
*
|
||||
* By default, new build definitions are not set up to clean this directory.
|
||||
* You can define your build to clean it up on the Repository tab (https://www.visualstudio.com/en-us/docs/build/define/repository).
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('BINARIESDIRECTORY ');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "definitionName", {
|
||||
/**
|
||||
* The name of the build definition.
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('DEFINITIONNAME ');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "definitionVersion", {
|
||||
/**
|
||||
* The version of the build definition.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('DEFINITIONVERSION ');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "queuedBy", {
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('QUEUEDBY');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "queuedById", {
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('QUEUEDBYID');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "reason", {
|
||||
/**
|
||||
* The event that caused the build to run
|
||||
* See
|
||||
* - https://www.visualstudio.com/en-us/docs/build/define/triggers
|
||||
* - https://www.visualstudio.com/en-us/docs/git/branch-policies
|
||||
*/
|
||||
get: function () {
|
||||
var value = this.get('REASON');
|
||||
// convert to enum for easy consumption
|
||||
var reasonMap = {};
|
||||
reasonMap['Manual'] = build_reason_1.BuildReason.manual;
|
||||
reasonMap['IndividualCI'] = build_reason_1.BuildReason.individualCI;
|
||||
reasonMap['BatchedCI'] = build_reason_1.BuildReason.batchedCI;
|
||||
reasonMap['Schedule'] = build_reason_1.BuildReason.schedule;
|
||||
reasonMap['ValidateShelveset'] = build_reason_1.BuildReason.validateShelveset;
|
||||
reasonMap['CheckInShelveset'] = build_reason_1.BuildReason.checkInShelveset;
|
||||
reasonMap['PullRequest'] = build_reason_1.BuildReason.pullRequest;
|
||||
return reasonMap[value];
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "requestedFor", {
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
* Note: This value can contain whitespace or other invalid label characters. In these cases, the label format will fail
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('REQUESTEDFOR');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "requestedForEmail", {
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('REQUESTEDFOREMAIL');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "requestedForId", {
|
||||
/**
|
||||
* See 'How are the identity variables set?': https://www.visualstudio.com/en-us/docs/build/define/variables#identity_values
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('REQUESTEDFORID');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "sourceBranch", {
|
||||
/**
|
||||
* The branch the build was queued for.
|
||||
*
|
||||
* Some examples:
|
||||
* - Git repo branch: 'refs/heads/master'
|
||||
* - Git repo pull request: 'refs/pull/1/merge'
|
||||
* - TFVC repo branch: '$/teamproject/main'
|
||||
* - TFVC repo gated check-in: 'Gated_2016-06-06_05.20.51.4369;username@live.com'
|
||||
* - TFVC repo shelveset build: 'myshelveset;username@live.com'
|
||||
*
|
||||
* When you use this variable in your build number format,
|
||||
* the forward slash characters (/) are replaced with underscore characters _).
|
||||
*
|
||||
* Note: In TFVC, if you are running a gated check-in build or manually building a shelveset,
|
||||
* you cannot use this variable in your build number format.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('SOURCEBRANCH');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "sourceBranchName", {
|
||||
/**
|
||||
* The name of the branch the build was queued for.
|
||||
* - Git repo branch or pull request: The last path segment in the ref.
|
||||
* For example, in 'refs/heads/master' this value is 'master'.
|
||||
* - TFVC repo branch: The last path segment in the root server path for the workspace.
|
||||
* For example in '$/teamproject/main' this value is 'main'.
|
||||
* - TFVC repo gated check-in or shelveset build is the name of the shelveset.
|
||||
* For example, 'Gated_2016-06-06_05.20.51.4369;username@live.com' or 'myshelveset;username@live.com'.
|
||||
*
|
||||
* Note: In TFVC, if you are running a gated check-in build or manually building a shelveset,
|
||||
* you cannot use this variable in your build number format.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('SOURCEBRANCHNAME');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "SourcesDirectory", {
|
||||
/**
|
||||
* The local path on the agent where your source code files are downloaded.
|
||||
* For example: 'c:\agent\_work\1\s'
|
||||
*
|
||||
* By default, new build definitions update only the changed files.
|
||||
* You can modify how files are downloaded on the Repository tab.
|
||||
*
|
||||
* See https://www.visualstudio.com/en-us/docs/build/define/repository
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('SOURCESDIRECTORY');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "SourceVersion", {
|
||||
/**
|
||||
* The latest version control change that is included in this build.
|
||||
* - Git: The commit ID.
|
||||
* - TFVC: the changeset number.
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('SOURCEVERSION');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(BuildEnvironment.prototype, "StagingDirectory", {
|
||||
/**
|
||||
* The local path on the agent where any artifacts are copied to before being pushed to their destination.
|
||||
* For example: 'c:\agent\_work\1\a'.
|
||||
*
|
||||
* A typical way to use this folder is to publish your build artifacts with the
|
||||
* 'Copy files' (https://www.visualstudio.com/en-us/docs/build/steps/utility/copy-files) and
|
||||
* 'Publish build artifacts' (https://www.visualstudio.com/en-us/docs/build/steps/utility/publish-build-artifacts) steps
|
||||
*
|
||||
* Note: This directory is purged before each new build, so you don't have to clean it up yourself.
|
||||
*
|
||||
* Build.ArtifactStagingDirectory and Build.StagingDirectory are interchangeable.
|
||||
*
|
||||
* See https://www.visualstudio.com/en-us/docs/build/concepts/definitions/build/artifacts
|
||||
*/
|
||||
get: function () {
|
||||
return this.get('STAGINGDIRECTORY');
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return BuildEnvironment;
|
||||
}(vsts_environment_1.VSTSEnvironment));
|
||||
exports.BuildEnvironment = BuildEnvironment;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92c3RzL2Vudmlyb25tZW50L2J1aWxkL2J1aWxkLWVudmlyb25tZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLHdEQUFzRDtBQUN0RCwrQ0FBNkM7QUFDN0MsK0VBQTRFO0FBRTVFO0lBQXNDLG9DQUFlO0lBQXJEO1FBQUEscUVBNE5DO1FBMU5HOztXQUVHO1FBQ2EsZ0JBQVUsR0FBK0IsSUFBSSx5REFBME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7V0FJRzthQUNIO1lBQ0ksTUFBTSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsZUFBZSxDQUFDLENBQUM7UUFDckMsQ0FBQzs7O09BQUE7SUFnQkQsc0JBQVcsOENBQWdCO1FBZDNCOzs7Ozs7Ozs7Ozs7O1dBYUc7YUFDSDtZQUNJLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLGtCQUFrQixDQUFDLENBQUM7UUFDeEMsQ0FBQzs7O09BQUE7SUFDTCx1QkFBQztBQUFELENBNU5BLEFBNE5DLENBNU5xQyxrQ0FBZSxHQTROcEQ7QUE1TlksNENBQWdCIiwiZmlsZSI6InZzdHMvZW52aXJvbm1lbnQvYnVpbGQvYnVpbGQtZW52aXJvbm1lbnQuanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiQzpcXEJBXFw0MTdcXHMifQ==
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* Vsts Build reasons.
|
||||
*/
|
||||
export declare enum BuildReason {
|
||||
/**
|
||||
* A user manually queued the build.
|
||||
*/
|
||||
manual = 0,
|
||||
/**
|
||||
* Continuous integration (CI) triggered bu a Git push or a TFVC check-in.
|
||||
*/
|
||||
individualCI = 1,
|
||||
/**
|
||||
* Continuous integration (CI) triggered bu a Git push or a TFVC check-in, and the Batch changes was selected.
|
||||
*/
|
||||
batchedCI = 2,
|
||||
/**
|
||||
* Scheduled trigger.
|
||||
*/
|
||||
schedule = 3,
|
||||
/**
|
||||
* Gated check-in trigger.
|
||||
*/
|
||||
validateShelveset = 4,
|
||||
/**
|
||||
* A user manually queued the build of a specific TFVC shelveset.
|
||||
*/
|
||||
checkInShelveset = 5,
|
||||
/**
|
||||
* The build was triggered by a Git branch policy that requires a build.
|
||||
*/
|
||||
pullRequest = 6,
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Vsts Build reasons.
|
||||
*/
|
||||
var BuildReason;
|
||||
(function (BuildReason) {
|
||||
/**
|
||||
* A user manually queued the build.
|
||||
*/
|
||||
BuildReason[BuildReason["manual"] = 0] = "manual";
|
||||
/**
|
||||
* Continuous integration (CI) triggered bu a Git push or a TFVC check-in.
|
||||
*/
|
||||
BuildReason[BuildReason["individualCI"] = 1] = "individualCI";
|
||||
/**
|
||||
* Continuous integration (CI) triggered bu a Git push or a TFVC check-in, and the Batch changes was selected.
|
||||
*/
|
||||
BuildReason[BuildReason["batchedCI"] = 2] = "batchedCI";
|
||||
/**
|
||||
* Scheduled trigger.
|
||||
*/
|
||||
BuildReason[BuildReason["schedule"] = 3] = "schedule";
|
||||
/**
|
||||
* Gated check-in trigger.
|
||||
*/
|
||||
BuildReason[BuildReason["validateShelveset"] = 4] = "validateShelveset";
|
||||
/**
|
||||
* A user manually queued the build of a specific TFVC shelveset.
|
||||
*/
|
||||
BuildReason[BuildReason["checkInShelveset"] = 5] = "checkInShelveset";
|
||||
/**
|
||||
* The build was triggered by a Git branch policy that requires a build.
|
||||
*/
|
||||
BuildReason[BuildReason["pullRequest"] = 6] = "pullRequest";
|
||||
})(BuildReason = exports.BuildReason || (exports.BuildReason = {}));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92c3RzL2Vudmlyb25tZW50L2J1aWxkL2J1aWxkLXJlYXNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBOztHQUVHO0FBQ0gsSUFBWSxXQTZCWDtBQTdCRCxXQUFZLFdBQVc7SUFDbkI7O09BRUc7SUFDSCxpREFBTSxDQUFBO0lBQ047O09BRUc7SUFDSCw2REFBWSxDQUFBO0lBQ1o7O09BRUc7SUFDSCx1REFBUyxDQUFBO0lBQ1Q7O09BRUc7SUFDSCxxREFBUSxDQUFBO0lBQ1I7O09BRUc7SUFDSCx1RUFBaUIsQ0FBQTtJQUNqQjs7T0FFRztJQUNILHFFQUFnQixDQUFBO0lBQ2hCOztPQUVHO0lBQ0gsMkRBQVcsQ0FBQTtBQUNmLENBQUMsRUE3QlcsV0FBVyxHQUFYLG1CQUFXLEtBQVgsbUJBQVcsUUE2QnRCIiwiZmlsZSI6InZzdHMvZW52aXJvbm1lbnQvYnVpbGQvYnVpbGQtcmVhc29uLmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsXSwic291cmNlUm9vdCI6IkM6XFxCQVxcNDE3XFxzIn0=
|
|
@ -1,50 +0,0 @@
|
|||
import { VSTSEnvironment } from '../vsts-environment';
|
||||
import { RepositoryType } from './repository-type';
|
||||
export declare class BuildRepositoryEnvironment extends VSTSEnvironment {
|
||||
/**
|
||||
* Gets a vsts build env variable
|
||||
* @param name the name of the env var to get
|
||||
*/
|
||||
protected get(name: string): string;
|
||||
/**
|
||||
* The value you've selected for Clean on the repository tab
|
||||
* See https://www.visualstudio.com/en-us/docs/build/define/repository.
|
||||
*/
|
||||
readonly clean: boolean;
|
||||
/**
|
||||
* The local path on the agent where your source code files are downloaded.
|
||||
* For example: 'c:\agent\_work\1\s'.
|
||||
*
|
||||
* By default, new build definitions update only the changed files.
|
||||
* You can modify how files are downloaded on the Repository tab.
|
||||
*
|
||||
* See https://www.visualstudio.com/en-us/docs/build/define/repository.
|
||||
*/
|
||||
readonly localPath: string;
|
||||
/**
|
||||
* The name of the repository
|
||||
* See: https://www.visualstudio.com/en-us/docs/build/define/repository
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* The Repository Type for this build
|
||||
* See: https://www.visualstudio.com/en-us/docs/build/define/repository
|
||||
*/
|
||||
readonly type: RepositoryType;
|
||||
/**
|
||||
* Defined for repositories of type 'TfsVersionControl'.
|
||||
* The name of the TFVC workspace used by the build agent.
|
||||
*
|
||||
* For example, if the Agent.BuildDirectory is 'c:\agent\_work\12' and the Agent.Id is 8,
|
||||
* the workspace name could be: 'ws_12_8'
|
||||
*/
|
||||
readonly tfcvWorkspace: string;
|
||||
/**
|
||||
* The URL for the repository.
|
||||
*
|
||||
* For example:
|
||||
* - Git: https://fabrikamfiber.visualstudio.com/_git/Scripts
|
||||
* - TFVC: https://fabrikamfiber.visualstudio.com/
|
||||
*/
|
||||
readonly uri: string;
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче