Skip to content
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
32 changes: 32 additions & 0 deletions build/build-legacy-javascript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import fs from 'fs';

import esbuild from 'esbuild';
import esMain from 'es-main';

import {LH_ROOT} from '../shared/root.js';

async function buildPackage() {
await esbuild.build({
entryPoints: ['core/lib/legacy-javascript/legacy-javascript.js'],
outfile: 'dist/legacy-javascript/legacy-javascript.js',
format: 'esm',
bundle: true,
});

fs.copyFileSync(`${LH_ROOT}/core/lib/legacy-javascript/package.json`,
'dist/legacy-javascript/package.json');
}

async function main() {
await buildPackage();
}

if (esMain(import.meta)) {
await main();
}
14 changes: 14 additions & 0 deletions core/lib/legacy-javascript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "legacy-javascript",
"type": "module",
"version": "0.0.1",
"description": "Identify legacy polyfills and code transforms",
"main": "./legacy-javascript.js",
"repository": "GoogleChrome/lighthouse",
"author": "Google LLC",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/GoogleChrome/lighthouse/issues"
},
"homepage": "https://github.com/GoogleChrome/lighthouse#readme"
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
"prepack": "yarn build-report --standalone --flow --esm && yarn build-types",
"postpack": "yarn clean-types",
"build-all": "npm-run-posix-or-windows build-all:task",
"build-all:task": "yarn build-report && yarn build-cdt-strings && yarn build-devtools && concurrently 'yarn build-extension' 'yarn build-lr' 'yarn build-viewer' 'yarn build-treemap' 'yarn build-smokehouse-bundle' && yarn build-pack",
"build-all:task:windows": "yarn build-report && yarn build-cdt-strings && yarn build-extension && yarn build-devtools && yarn build-lr && yarn build-viewer && yarn build-treemap && yarn build-smokehouse-bundle",
"build-all:task": "yarn build-report && yarn build-cdt-strings && yarn build-devtools && concurrently 'yarn build-extension' 'yarn build-lr' 'yarn build-viewer' 'yarn build-treemap' 'yarn build-smokehouse-bundle' 'yarn build-legacy-javascript' && yarn build-pack",
"build-all:task:windows": "yarn build-report && yarn build-cdt-strings && yarn build-extension && yarn build-devtools && yarn build-lr && yarn build-viewer && yarn build-treemap && yarn build-smokehouse-bundle && yarn build-legacy-javascript",
"build-cdt-lib": "node ./build/build-cdt-lib.js",
"build-cdt-strings": "node ./build/build-cdt-strings.js",
"build-extension": "yarn build-extension-chrome && yarn build-extension-firefox",
"build-extension-chrome": "node ./build/build-extension.js chrome",
"build-extension-firefox": "node ./build/build-extension.js firefox",
"build-devtools": "yarn reset-link && node ./build/build-bundle.js clients/devtools/devtools-entry.js dist/lighthouse-dt-bundle.js && node ./build/build-dt-report-resources.js",
"build-legacy-javascript": "node ./build/build-legacy-javascript.js",
"build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
"build-lr": "yarn reset-link && node --max-old-space-size=4096 ./build/build-lightrider-bundles.js",
"build-pack": "bash build/build-pack.sh",
Expand Down
Loading