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

Reduce node polyfills #3922

Merged
merged 3 commits into from
Aug 2, 2022
Merged

Reduce node polyfills #3922

merged 3 commits into from
Aug 2, 2022

Conversation

fregante
Copy link
Collaborator

This PR just addresses some minor issues I encountered while debugging #3915

@fregante fregante requested a review from twschiller July 30, 2022 11:52
@@ -256,14 +256,6 @@ module.exports = (env, options) =>
...(isProd(options) || process.env.DEV_REDUX_LOGGER === "false"
? { "redux-logger": false }
: {}),

// Enables static analysis and removal of dead code
"webext-detect-page": path.resolve(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't save much at the moment, dropping

),

// Lighter jQuery version
jquery: "jquery/dist/jquery.slim.min.js",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to the shared config

REDUX_DEV_TOOLS: !isProd(options),
NPM_PACKAGE_VERSION: process.env.npm_package_version,
ENVIRONMENT: process.env.ENVIRONMENT ?? options.mode,
ENVIRONMENT: options.mode,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EnvironmentPlugin already uses process.env natively. As the comment suggests, these are just fallback values

},
extensions: [".ts", ".tsx", ".jsx", ".js"],
fallback: {
http: false,
https: false,
Copy link
Collaborator Author

@fregante fregante Jul 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume we don't use external references in our schemas. If we do, I'll have to restore these 2 polyfills in NodePolyfillPlugin until:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the schema URL references count? I don't think they are being actually requested anywhere.

const SCHEMA_URLS: Record<string, UnknownObject> = {

We also have "external" references in blocks definitions (some of them like pipeline don't work though):

$ref: "https://app.pixiebrix.com/schemas/pipeline#",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's exactly it, $ref will be "resolved", in this case by first fetching the external schema (I presume): https://github.com/APIDevTools/json-schema-ref-parser#the-solution

I restored the http/https polyfills for now, hopefully the maintainers will use fetch in the future.

@codecov-commenter
Copy link

Codecov Report

Merging #3922 (fa8ee70) into main (1cf3298) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #3922   +/-   ##
=======================================
  Coverage   46.71%   46.71%           
=======================================
  Files         858      858           
  Lines       25446    25446           
  Branches     5313     5313           
=======================================
  Hits        11887    11887           
  Misses      12622    12622           
  Partials      937      937           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1cf3298...fa8ee70. Read the comment docs.

},
extensions: [".ts", ".tsx", ".jsx", ".js"],
fallback: {
http: false,
https: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the schema URL references count? I don't think they are being actually requested anywhere.

const SCHEMA_URLS: Record<string, UnknownObject> = {

We also have "external" references in blocks definitions (some of them like pipeline don't work though):

$ref: "https://app.pixiebrix.com/schemas/pipeline#",

Copy link
Collaborator Author

@fregante fregante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoketested, every context and common actions work, merging

@fregante fregante enabled auto-merge (squash) August 2, 2022 18:13
@fregante fregante merged commit a727f14 into main Aug 2, 2022
@fregante fregante deleted the F/dev/node branch August 2, 2022 18:19
@twschiller twschiller added this to the 1.7.3 milestone Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants