Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📦 Update core devDependencies (minor) #33200

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions build-system/tasks/dep-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const {cyan, green, red, yellow} = require('kleur/colors');
const {getEsbuildBabelPlugin} = require('../common/esbuild-babel');
const {log, logLocalDev} = require('../common/logging');

const depCheckDir = '.amp-dep-check';

/**
* @typedef {{
* name: string,
Expand Down Expand Up @@ -181,35 +179,30 @@ async function getEntryPointModule() {
.filter((x) => fs.statSync(x).isDirectory())
.map(getEntryPoint);
const allEntryPoints = flatten(extensionEntryPoints).concat(coreBinaries);
await fs.ensureDir(depCheckDir);
const entryPointModule = path.join(depCheckDir, 'entry-point-module.js');
const entryPointData = allEntryPoints
.map((file) => `import '../${file}';`)
.map((file) => `import './${file}';`)
.join('\n');
await fs.promises.writeFile(entryPointModule, entryPointData);
logLocalDev('Added all entry points to', cyan(entryPointModule));
return entryPointModule;
return entryPointData;
}

/**
* @param {string} entryPointModule
* @return {!Promise<ModuleDef>}
*/
async function getModuleGraph(entryPointModule) {
const bundleFile = path.join(depCheckDir, 'entry-point-bundle.js');
const moduleGraphFile = path.join(depCheckDir, 'module-graph.json');
const plugin = getEsbuildBabelPlugin('dep-check', /* enableCache */ false);
await esbuild.build({
entryPoints: [entryPointModule],
const plugin = getEsbuildBabelPlugin('dep-check', /* enableCache */ true);
const result = await esbuild.build({
stdin: {
contents: entryPointModule,
resolveDir: '.',
},
bundle: true,
outfile: bundleFile,
metafile: moduleGraphFile,
write: false,
metafile: true,
plugins: [plugin],
});
logLocalDev('Bundled all entry points into', cyan(bundleFile));

const moduleGraphJson = await fs.readJson(moduleGraphFile);
const entryPoints = moduleGraphJson.inputs;
const entryPoints = result.metafile.inputs;
const moduleGraph = Object.create(null);
moduleGraph.name = entryPointModule;
moduleGraph.deps = [];
Expand All @@ -220,7 +213,7 @@ async function getModuleGraph(entryPointModule) {
deps: entryPoints[entryPoint].imports.map((dep) => dep.path),
});
}
logLocalDev('Extracted module graph from', cyan(moduleGraphFile));
logLocalDev('Extracted module graph');
return moduleGraph;
}

Expand Down
4 changes: 2 additions & 2 deletions build-system/tasks/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ async function compileUnminifiedJs(srcDir, srcFilename, destDir, options) {
const sentinel = '<%= contents %>';
const start = wrapper.indexOf(sentinel);
return {
banner: wrapper.slice(0, start),
footer: wrapper.slice(start + sentinel.length),
banner: {js: wrapper.slice(0, start)},
footer: {js: wrapper.slice(start + sentinel.length)},
};
}

Expand Down
56 changes: 22 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"del": "6.0.0",
"enzyme": "3.11.0",
"enzyme-adapter-preact-pure": "3.0.0",
"esbuild": "0.8.57",
"esbuild": "0.9.3",
"escodegen": "2.0.0",
"eslint": "7.22.0",
"eslint-config-prettier": "8.1.0",
Expand Down Expand Up @@ -115,18 +115,18 @@
"html-minifier": "4.0.0",
"istanbul-middleware": "0.2.2",
"jest-dot-reporter": "1.0.12",
"jest-silent-reporter": "0.4.0",
"jest-silent-reporter": "0.5.0",
"jison": "0.4.18",
"jscodeshift": "0.11.0",
"jsdom": "16.5.0",
"json-stable-stringify": "1.0.1",
"json5": "2.2.0",
"jsonminify": "0.4.1",
"karma": "6.1.1",
"karma": "6.2.0",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-esbuild": "2.0.0",
"karma-esbuild": "2.1.1",
"karma-firefox-launcher": "2.1.0",
"karma-fixture": "0.2.6",
"karma-html2js-preprocessor": "1.1.0",
Expand Down