本文整理匯總了TypeScript中gulp-sourcemaps.write函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript write函數的具體用法?TypeScript write怎麽用?TypeScript write使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了write函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getCompilerSettings
gulp.task(instrumenterJsPath, false, [servicesFile], () => {
const settings: tsc.Settings = getCompilerSettings({
outFile: instrumenterJsPath
}, /*useBuiltCompiler*/ true);
return gulp.src(instrumenterPath)
.pipe(newer(instrumenterJsPath))
.pipe(sourcemaps.init())
.pipe(tsc(settings))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("."));
});
示例2: merge
gulp.task('tsc:jasmineHelper', () => {
var tsResult = gulp.src(env.path.jasmine.helpers)
.pipe(sourcemaps.init())
.pipe(ts(tsConf));
return merge([
tsResult.dts.pipe(gulp.dest(`${env.dir.jasmine}`)),
tsResult.js.pipe(sourcemaps.write()).pipe(gulp.dest(env.dir.tmpJasmine)),
]);
});
示例3: error
gulp.task("scripts:tsjs", ["scripts:coffee", "scripts:js", "scripts:ts"], () => {
function error(err: {message: string}) {
const raw = stripAnsi(err.message)
const result = raw.match(/(.*)(\(\d+,\d+\): error TS(\d+):.*)/)
if (result != null) {
const [, file, rest, code] = result
const real = path.join('src', 'coffee', ...file.split(path.sep).slice(3))
if (fs.existsSync(real)) {
gutil.log(`${chalk.red(real)}${rest}`)
return
}
// XXX: can't enable "6133", because CS generates faulty code for closures
if (["2307", "2688", "6053"].indexOf(code) != -1) {
gutil.log(err.message)
return
}
}
if (!argv.ts)
return
if (typeof argv.ts === "string") {
const keywords = argv.ts.split(",")
for (let keyword of keywords) {
let must = true
if (keyword[0] == "^") {
keyword = keyword.slice(1)
must = false
}
const found = err.message.indexOf(keyword) != -1
if (!((found && must) || (!found && !must)))
return
}
}
gutil.log(err.message)
}
const tree_ts = paths.build_dir.tree_ts
const project = gulp
.src(`${tree_ts}/**/*.ts`)
.pipe(sourcemaps.init())
.pipe(ts(tsconfig.compilerOptions, ts.reporter.nullReporter()).on('error', error))
return merge([
project.js
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(paths.build_dir.tree_js)),
project.dts
.pipe(gulp.dest(paths.build_dir.types)),
])
})
示例4: compileTypeScriptFor
function compileTypeScriptFor(moduleType: string) {
const options = project.plugin.outputs[moduleType].settings;
const compile = createCompiler(options);
return gulp
.src(path.join(root, project.plugin.src, '**/*.ts'))
.pipe(sourcemaps.init())
.pipe(compile())
.pipe(sourcemaps.write({ sourceRoot: project.plugin.src }))
.pipe(gulp.dest(path.join(project.plugin.output, moduleType)));
}
示例5: getCompilerSettings
gulp.task(run, false, [servicesFile], () => {
const settings: tsc.Settings = getCompilerSettings({
outFile: run
}, /*useBuiltCompiler*/ true);
return gulp.src(harnessSources)
.pipe(newer(run))
.pipe(sourcemaps.init())
.pipe(tsc(settings))
.pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" }))
.pipe(gulp.dest("."));
});
示例6:
export = gulp.task('development:styles', () => {
return gulp
.src(paths.sources.styles)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(autoprefixer(config.autoprefixer))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.output.styles))
.on('error', errors)
.pipe(browsersync.stream());
});
示例7:
gulp.task('tsc:e2e', () => {
return gulp.src(env.path.spec.protractor)
.pipe(sourcemaps.init())
.pipe(ts({
target: 'es5',
module: "commonjs",
noImplicitAny: true,
moduleResolution: 'node',
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(env.dir.tmpE2e));
});
示例8: tsProjectFn
gulp.task('build:js', 'compile *.ts files into *.js files', ['build:tslint'], () => {
var tsProject = tsProjectFn();
var tsResult = gulp.src(PATH.src.ts)
.pipe(printFiles())
.pipe(sourcemaps.init())
.pipe(tsc(tsProject));
return tsResult.js
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(PATH.dest.base));
});