-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Boost: Use "critical css gen" package from the monorepo (#39509)
* Update Boost to use "critical css gen" package from the monorepo * add changelog * Update Boost to use new browser and node from "critical css gen" package * add changelog * Update package entry points * Cleanup package entry points * Use dynamic import for global type definitions * Add browser entry point back to package * Use dynamic import for css generator * Don't use destructuring * Update default entry point to use browser version * Update Boost to use updated package entry point * Simplify package build * Remove unnecessary dependency enqueue * Attempt to fix tests * Rename dynamically imported file * Merge dynamic import files * Add build step for tests * Cleanup build for tests * Fix tests breaking due to missing package build * Update package entry points Co-authored-by: Brad Jorsch <[email protected]> * Add helper for critical css generator import * update changelogs --------- Co-authored-by: Brad Jorsch <[email protected]>
- Loading branch information
Showing
19 changed files
with
164 additions
and
352 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/vendor | ||
/node_modules | ||
/build-node | ||
/build-browser | ||
/build | ||
/tests/build |
4 changes: 4 additions & 0 deletions
4
projects/js-packages/critical-css-gen/changelog/add-playwright-endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
Add /playwright entry point for BrowserInterfacePlaywright. |
4 changes: 4 additions & 0 deletions
4
projects/js-packages/critical-css-gen/changelog/update-default-entry-point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: major | ||
Type: changed | ||
|
||
Change default entry point of package to include BrowserInterfaceIframe instead of BrowserInterfacePlaywright. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,48 +15,46 @@ | |
"license": "GPL-2.0-or-later", | ||
"author": "Automattic", | ||
"scripts": { | ||
"build:browser": "rollup -c", | ||
"build:node": "tsc", | ||
"build": "pnpm run clean && pnpm run build:browser && pnpm run build:node", | ||
"clean": "rm -rf build-node/ && rm -rf build-browser/", | ||
"test": "pnpm build && NODE_ENV=test NODE_PATH=./node_modules jest --forceExit --config=tests/config/jest.config.js" | ||
"build": "pnpm run clean && tsc", | ||
"build:test": "pnpm run clean:test && webpack --config tests/data/webpack.config.cjs", | ||
"clean": "rm -rf build/", | ||
"clean:test": "rm -rf tests/build/", | ||
"test": "pnpm build && pnpm build:test && NODE_ENV=test NODE_PATH=./node_modules jest --forceExit --config=tests/config/jest.config.js" | ||
}, | ||
"main": "./build-node/node.js", | ||
"browser": "./build-browser/bundle.js", | ||
"main": "./build/browser.js", | ||
"devDependencies": { | ||
"@automattic/jetpack-webpack-config": "workspace:*", | ||
"@babel/core": "7.24.7", | ||
"@babel/preset-env": "7.24.7", | ||
"@babel/preset-typescript": "7.24.7", | ||
"@rollup/plugin-commonjs": "26.0.1", | ||
"@rollup/plugin-json": "6.1.0", | ||
"@rollup/plugin-node-resolve": "15.3.0", | ||
"@rollup/plugin-terser": "0.4.3", | ||
"@rollup/plugin-typescript": "12.1.0", | ||
"@types/clean-css": "4.2.11", | ||
"@types/css-tree": "2.3.8", | ||
"@types/node": "^20.4.2", | ||
"express": "4.20.0", | ||
"jest": "29.7.0", | ||
"path-browserify": "1.0.1", | ||
"playwright": "1.45.1", | ||
"playwright-core": "^1.45.1", | ||
"prettier": "npm:[email protected]", | ||
"rollup": "3.29.5", | ||
"rollup-plugin-polyfill-node": "0.13.0", | ||
"process": "0.11.10", | ||
"source-map": "0.7.4", | ||
"source-map-js": "1.2.0", | ||
"tslib": "2.5.0", | ||
"typescript": "5.0.4", | ||
"webpack": "5.94.0", | ||
"webpack-cli": "4.9.1", | ||
"webpack-dev-middleware": "5.3.4" | ||
}, | ||
"exports": { | ||
".": { | ||
"jetpack:src": "./src/node.ts", | ||
"types": "./build-node/node.d.ts", | ||
"browser": "./build-browser/bundle.js", | ||
"import": "./build-node/node.js", | ||
"require": "./build-node/node.js", | ||
"default": "./build-node/node.js" | ||
"jetpack:src": "./src/browser.ts", | ||
"types": "./build/browser.d.ts", | ||
"default": "./build/browser.js" | ||
}, | ||
"./playwright": { | ||
"jetpack:src": "./src/playwright.ts", | ||
"types": "./build/playwright.d.ts", | ||
"default": "./build/playwright.js" | ||
} | ||
}, | ||
"dependencies": { | ||
|
This file was deleted.
Oops, something went wrong.
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
projects/js-packages/critical-css-gen/tests/data/webpack.config.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const path = require( 'path' ); | ||
const jetpackWebpackConfig = require( '@automattic/jetpack-webpack-config/webpack' ); | ||
const webpack = require( 'webpack' ); | ||
|
||
module.exports = { | ||
entry: path.join( __dirname, '../../src/browser.ts' ), | ||
mode: 'development', | ||
devtool: false, | ||
output: { | ||
...jetpackWebpackConfig.output, | ||
path: path.join( __dirname, '../build' ), | ||
filename: 'bundle.js', | ||
library: 'CriticalCSSGenerator', | ||
}, | ||
resolve: { | ||
...jetpackWebpackConfig.resolve, | ||
// These are needed for the build to work, | ||
// otherwise it errors out because of the clean-css dependency. | ||
fallback: { | ||
...jetpackWebpackConfig.resolve.fallback, | ||
path: require.resolve( 'path-browserify' ), | ||
process: require.resolve( 'process/browser' ), | ||
url: false, | ||
https: false, | ||
http: false, | ||
fs: false, | ||
os: false, | ||
}, | ||
}, | ||
node: false, | ||
plugins: [ | ||
new webpack.ProvidePlugin( { | ||
process: require.resolve( 'process/browser' ), | ||
} ), | ||
], | ||
module: { | ||
strictExportPresence: true, | ||
rules: [ | ||
// Transpile JavaScript | ||
jetpackWebpackConfig.TranspileRule( { | ||
exclude: /node_modules\//, | ||
} ), | ||
|
||
// Transpile @automattic/jetpack-* in node_modules too. | ||
jetpackWebpackConfig.TranspileRule( { | ||
includeNodeModules: [ '@automattic/jetpack-' ], | ||
} ), | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/js-packages/critical-css-gen/tests/unit/generate-critical-css.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
projects/plugins/boost/changelog/update-use-monorepo-css-gen-package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: changed | ||
Comment: Use css gen package from monorepo instead of external repo. | ||
|
||
|
Oops, something went wrong.