Skip to content

Commit

Permalink
revert functional changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyajones committed Feb 9, 2021
1 parent d550be7 commit 8b9dbdf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
6 changes: 3 additions & 3 deletions build-system/tasks/css/jsify-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const fs = require('fs-extra');
const { default: postcss, LazyResult } = require('postcss');
const postcss = require('postcss');
const postcssImport = require('postcss-import');
const {log} = require('../../common/logging');
const {red} = require('ansi-colors');
Expand Down Expand Up @@ -58,7 +58,7 @@ const cssNanoDefaultOptions = {
* @param {string} cssStr the css text to transform
* @param {!Object=} opt_cssnano cssnano options
* @param {!Object=} opt_filename the filename of the file being transformed. Used for sourcemaps generation.
* @return {!LazyResult} that resolves with the css content after
* @return {!Promise<string>} that resolves with the css content after
* processing
*/
function transformCss(cssStr, opt_cssnano, opt_filename) {
Expand All @@ -82,7 +82,7 @@ function transformCss(cssStr, opt_cssnano, opt_filename) {
* @param {string} filename css file
* @param {!Object=} opt_cssnano cssnano options
* @return {!LazyResult} that resolves with the css content after
* @return {!Promise<string>} that resolves with the css content after
* processing
*/
function transformCssFile(filename, opt_cssnano) {
Expand Down
31 changes: 11 additions & 20 deletions build-system/tasks/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const del = require('del');
const file = require('gulp-file');
const fs = require('fs-extra');
const gulp = require('gulp');
const MagicString = require('magic-string').default;
const MagicString = require('magic-string');
const open = require('open');
const path = require('path');
const regexpSourcemaps = require('gulp-regexp-sourcemaps');
const remapping = require('@ampproject/remapping').default;
const remapping = require('@ampproject/remapping');
const rename = require('gulp-rename');
const source = require('vinyl-source-stream');
const sourcemaps = require('gulp-sourcemaps');
Expand Down Expand Up @@ -209,14 +209,9 @@ function combineWithCompiledFile(srcFilename, destFilePath, options) {
});
// We need to inject the code _inside_ the extension wrapper
const destFileName = path.basename(destFilePath);
/**
* TODO(#28387) This should be import('magic-string').MagicStringOptions but
* is invalid until https://github.com/Rich-Harris/magic-string/pull/183
* is merged.
* @type {*}
*/
const magicStringOptions = {filename: destFileName};
const contents = new MagicString(fs.readFileSync(destFilePath, 'utf8'), magicStringOptions);
const contents = new MagicString(fs.readFileSync(destFilePath, 'utf8'), {
filename: destFileName,
});
const map = JSON.parse(fs.readFileSync(`${destFilePath}.map`, 'utf8'));
const {sourceRoot} = map;
map.sourceRoot = undefined;
Expand All @@ -233,14 +228,7 @@ function combineWithCompiledFile(srcFilename, destFilePath, options) {
bundle.addSource(wrapperOpen);
for (const bundleFile of bundleFiles) {
const contents = fs.readFileSync(bundleFile, 'utf8');
/**
* TODO(#28387) This should be import('magic-string').MagicStringOptions but
* is invalid until https://github.com/Rich-Harris/magic-string/pull/183
* is merged.
* @type {*}
*/
const magicStringOptions = {filename: bundleFile};
bundle.addSource(new MagicString(contents, magicStringOptions));
bundle.addSource(new MagicString(contents, {filename: bundleFile}));
bundle.append(MODULE_SEPARATOR);
}
bundle.addSource(remainingContents);
Expand Down Expand Up @@ -344,8 +332,11 @@ async function compileMinifiedJs(srcDir, srcFilename, destDir, options) {
* @param {string} destFilename
*/
function handleBundleError(err, continueOnError, destFilename) {
// Drop the node_modules call stack, which begins with ' at'.
const message = err.stack ? err.stack.replace(/ at[^]*/, '').trim() : err;
let message = err;
if (err.stack) {
// Drop the node_modules call stack, which begins with ' at'.
message = err.stack.replace(/ at[^]*/, '').trim();
}
log(red('ERROR:'), message, '\n');
const reasonMessage = `Could not compile ${cyan(destFilename)}`;
if (continueOnError) {
Expand Down
2 changes: 0 additions & 2 deletions build-system/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
"incremental": true,
"esModuleInterop": true,
"declaration": true
// I would love to be able to turn this on but it will be quite hard for now.
// "noImplicitAny": true
},
"include": [
"./*.js",
Expand Down

0 comments on commit 8b9dbdf

Please sign in to comment.