-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
23 lines (21 loc) · 1.04 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Only use gulp-dumber to compile browser-test code
const gulp = require('gulp');
const dumber = require('gulp-dumber');
const fs = require('fs');
const dr = dumber({
src: 'lib',
append: ["requirejs(['../test/all-browser-spec.js'], function() { console.log('# tests loaded')});"],
// append: ["requirejs(['../test/transform.spec.js'], function() { console.log('# tests loaded')});"],
onRequire(moduleId) {
if (moduleId === '@parcel/source-map/parcel_sourcemap_wasm/dist-web/parcel_sourcemap_wasm.js') {
const content = fs.readFileSync(require.resolve(moduleId), 'utf8');
const patched = content.replace(/new URL\((?:'|")parcel_sourcemap_wasm_bg.wasm(?:'|"),\s*import.meta.url\)/, 'new URL("https://cdn.jsdelivr.net/npm/@parcel/[email protected]/parcel_sourcemap_wasm/dist-web/parcel_sourcemap_wasm_bg.wasm");');
return patched;
}
}
});
exports.default = function build() {
return gulp.src(['test/**/*.js', 'lib/**/*.js', 'package.json'], { sourcemaps: true})
.pipe(dr())
.pipe(gulp.dest('dist', { sourcemaps: true }));
};