privatenumber

privatenumber

I'm on a mission to open source my solutions 🚀

Member Since 10 years ago

@square, New York City

Experience Points
959
follower
Lessons Completed
101
follow
Lessons Completed
731
stars
Best Reply Awards
220
repos

3969 contributions in the last year

Pinned
⚡ ⚡️ Speed up your Webpack build with esbuild
⚡ ✅ タスク — The minimal task runner for Node.js
⚡ 🏃‍♂️🏃‍♀️🏃 JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler
⚡ ↔️ Interop Vue 2 components in Vue 3 apps and vice versa
⚡ 🤲 Create Fragments (multiple root-elements) in Vue 2
⚡ Snap a screenshot of a tweet 📸
Activity
Dec
5
4 hours ago
Activity icon
issue

privatenumber issue sindresorhus/eslint-plugin-unicorn

privatenumber
privatenumber

bug(prefer-object-from-entries): false negative when flattening array of objects

The prefer-object-from-entries rule reports that I should use Object.fromEntries() when I use Array#reduce to flatten an array of objects:

  27:38  error    Prefer `Object.fromEntries()` over `Array#reduce()`  unicorn/prefer-object-from-entries

It should not suggest that Object.fromEntries() be used here because it doesn't do the same thing:

const arrayOfObjects = [
	{ a: 1 },
	{ b: 2 },
	{ c: 3 }
];

const flattened = arrayOfObjects.reduce((flattened, next) => Object.assign(flattened, next), {});
// => { a: 1, b: 2, c: 3 }
Activity icon
created branch
createdAt 3 hours ago
Activity icon
issue

privatenumber issue pkg-size/action

privatenumber
privatenumber

feat: add token input

Is your feature request related to a problem? Please describe.

Manually passing in GITHUB_TOKEN is unnecessary.

Describe the solution you'd like

Extracted as default input. For example:

Describe alternatives you've considered

Additional context

Dec
4
1 day ago
Activity icon
issue

privatenumber issue comment peaceiris/actions-gh-pages

privatenumber
privatenumber

feat: default `github_token` to `github.token`

Fixes #309

privatenumber
privatenumber

I understand this change is not backwards compatible because of the case where users are using personal_token instead of github_token (so this is empty).

AFAIK, using a PAT or GITHUB_TOKEN is interchangeable (just different permissions).

Would it be possible to eventually consolidate these two inputs into a token that defaults to github.token?

Activity icon
fork

privatenumber forked peaceiris/actions-gh-pages

⚡ GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.
privatenumber MIT License Updated
fork time in 6 hours ago
push

privatenumber push privatenumber/webpack-localize-assets-plugin

privatenumber
privatenumber

fix: address deprecation warning with Chunk.getModules (#38)

commit sha: 793b24fea2651c1f37807bac15d531813a2ad402

push time in 8 hours ago
Activity icon
issue

privatenumber issue comment privatenumber/webpack-localize-assets-plugin

privatenumber
privatenumber

set testEnvironment: node

I was getting inconsistent test breakages on my machine. Not sure why, perhaps a pkg version mismatch. This seems to fix it

privatenumber
privatenumber

Can you try a clean dependency install?

It hasn't failed for me or on CI so it might be something on your end.

It shouldn't be necessary to add that because we're using [email protected]^27.3.1, which defaults to using a Node.js environment.

From their blogpost:

For this reason, we are changing the default test environment from "jsdom" to "node".

push

privatenumber push privatenumber/minification-benchmarks

privatenumber
privatenumber

fix(deps): update dependency esbuild to ^0.14.2 (#56)

Co-authored-by: Renovate Bot [email protected] Co-authored-by: github-actions [email protected]

commit sha: 8e8715b41534b6203117bb2272291233e0f90a0f

push time in 9 hours ago
pull request

privatenumber pull request privatenumber/minification-benchmarks

privatenumber
privatenumber

fix(deps): update dependency esbuild to ^0.14.2

WhiteSource Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
esbuild ^0.14.1 -> ^0.14.2 age adoption passing confidence

Release Notes

evanw/esbuild

v0.14.2

Compare Source

  • Add [ext] placeholder for path templates (#8203;1799)

    This release adds the [ext] placeholder to the --entry-names=, --chunk-names=, and --asset-names= configuration options. The [ext] placeholder takes the value of the file extension without the leading ., and can be used to place output files with different file extensions into different folders. For example, --asset-names=assets/[ext]/[name]-[hash] might generate an output path of assets/png/image-LSAMBFUD.png.

    This feature was contributed by @8203;LukeSheard.

  • Disable star-to-clause transform for external imports (#8203;1801)

    When bundling is enabled, esbuild automatically transforms import * as x from 'y'; x.z() into import {z} as 'y'; z() to improve tree shaking. This avoids needing to create the import namespace object x if it's unnecessary, which can result in the removal of large amounts of unused code. However, this transform shouldn't be done for external imports because that incorrectly changes the semantics of the import. If the export z doesn't exist in the previous example, the value x.z is a property access that is undefined at run-time, but the value z is an import error that will prevent the code from running entirely. This release fixes the problem by avoiding doing this transform for external imports:

    // Original code
    import * as x from 'y';
    x.z();
    
    // Old output (with --bundle --format=esm --external:y)
    import { z } from "y";
    z();
    
    // New output (with --bundle --format=esm --external:y)
    import * as x from "y";
    x.z();
    
  • Disable calc() transform for numbers with many fractional digits (#8203;1821)

    Version 0.13.12 introduced simplification of calc() expressions in CSS when minifying. For example, calc(100% / 4) turns into 25%. However, this is problematic for numbers with many fractional digits because either the number is printed with reduced precision, which is inaccurate, or the number is printed with full precision, which could be longer than the original expression. For example, turning calc(100% / 3) into 33.33333% is inaccurate and turning it into 33.333333333333336% likely isn't desired. In this release, minification of calc() is now disabled when any number in the result cannot be represented to full precision with at most five fractional digits.

  • Fix an edge case with catch scope handling (#8203;1812)

    This release fixes a subtle edge case with catch scope and destructuring assignment. Identifiers in computed properties and/or default values inside the destructuring binding pattern should reference the outer scope, not the inner scope. The fix was to split the destructuring pattern into its own scope, separate from the catch body. Here's an example of code that was affected by this edge case:

    // Original code
    let foo = 1
    try {
      throw ['a', 'b']
    } catch ({ [foo]: y }) {
      let foo = 2
      assert(y === 'b')
    }
    
    // Old output (with --minify)
    let foo=1;try{throw["a","b"]}catch({[o]:t}){let o=2;assert(t==="b")}
    
    // New output (with --minify)
    let foo=1;try{throw["a","b"]}catch({[foo]:t}){let o=2;assert(t==="b")}
    
  • Go 1.17.2 was upgraded to Go 1.17.4

    The previous release was built with Go 1.17.2, but this release is built with Go 1.17.4. This is just a routine upgrade. There are no changes significant to esbuild outside of some security-related fixes to Go's HTTP stack (but you shouldn't be running esbuild's dev server in production anyway).

    One notable change related to this is that esbuild's publishing script now ensures that git's state is free of uncommitted and/or untracked files before building. Previously this wasn't the case because publishing esbuild involved changing the version number, running the publishing script, and committing at the end, which meant that files were uncommitted during the build process. I also typically had some untracked test files in the same directory during publishing (which is harmless).

    This matters because there's an upcoming change in Go 1.18 where the Go compiler will include metadata about whether there are untracked files or not when doing a build: https://github.com/golang/go/issues/37475. Changing esbuild's publishing script should mean that when esbuild upgrades to Go 1.18, esbuild's binary executables will be marked as being built off of a specific commit without any modifications. This is important for reproducibility. Checking out a specific esbuild commit and building it should give a bitwise-identical binary executable to one that I published. But if this metadata indicated that there were untracked files during the published build, then the resulting executable would no longer be bitwise-identical.


Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by WhiteSource Renovate. View repository job log here.

Activity icon
delete
deleted time in 9 hours ago
Activity icon
issue

privatenumber issue peaceiris/actions-gh-pages

privatenumber
privatenumber

proposal: send deployment event

Checklist

  • I am using the latest version of this action.
  • I have read the latest README and followed the instructions.
  • I have read the latest GitHub Actions official documentation and learned the basic spec and concepts.

Describe your proposal

When using this action on a PR hook, I would like for it to update the banner in the PR to say that it has been deployed.

Currently, it says "This branch has not been deployed": Screen Shot 2021-12-04 at 4 28 40 AM

Describe the solution you'd like

Seems like the deploy status can be set by sending a deployment event: https://docs.github.com/en/rest/reference/repos#deployments

Describe alternatives you've considered

No alternatives

Additional context

Screenshot provided above

Activity icon
issue

privatenumber issue comment peaceiris/actions-gh-pages

privatenumber
privatenumber

Rename option name force_orphan to keep_history

Is your feature request related to a problem? Please describe

- force_orphan: true
+ keep_history: false  # default is true

Describe the solution you'd like

  • Add keep_history option to v3
  • Remove force_orphan in v4

Describe alternatives you've considered

N/A.

Additional context

N/A.

privatenumber
privatenumber

Nitpicky but what do you think of preserve_commit_history?

Activity icon
issue

privatenumber issue comment privatenumber/webpack-localize-assets-plugin

privatenumber
privatenumber

Mangled locale placeholder makes it through to HtmlWebpackPlugin

Bug description

I am trying to use webpack-localize-assets-plugin alongside html-webpack-plugin. My path starts with [locale] but in the compilation process this gets replaced with [locale:b64b2e3f]. Not the end of the world, but makes the work of replacing this with the appropriate locale name in the HTML generation a bit more complex.

It would be great if the original path name could be preserved.

Reproduction steps

Straightforward usage of both plugins (let me know if more is required).

Environment

  • webpack-localize-asets-plugin version: 1.2.4
  • Webpack version: 5.52.0
  • Operating System: Windows 10
  • Node version: 14.17.3
  • Package manager (npm/yarn/pnpm) and version: npm 7.20.0
privatenumber
privatenumber

Thanks for the reproduction @lewismoten.

What's your expected behavior?

I'm thinking instead of dist/index.html, it should emit dist/index.en.html which loads main.en.js (and so forth for each locale).

I haven't used HtmlWebpackPlugin but happy to review any PR to add support.

Dec
3
2 days ago
pull request

privatenumber pull request privatenumber/minification-benchmarks

privatenumber
privatenumber

fix(deps): update dependency google-closure-compiler to v20211006

WhiteSource Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
google-closure-compiler (source) ^20210808.0.0 -> ^20211006.0.0 age adoption passing confidence

Release Notes

google/closure-compiler-npm

v20211006.0.0

Compare Source

v20210907.0.0

Compare Source

v20210906.0.0

Compare Source


Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by WhiteSource Renovate. View repository job log here.

pull request

privatenumber pull request privatenumber/minification-benchmarks

privatenumber
privatenumber

fix(deps): update dependency esbuild to ^0.13.13

WhiteSource Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
esbuild ^0.13.12 -> ^0.13.13 age adoption passing confidence

Release Notes

evanw/esbuild

v0.13.13

Compare Source

  • Add more information about skipping "main" in package.json (#8203;1754)

    Configuring mainFields: [] breaks most npm packages since it tells esbuild to ignore the "main" field in package.json, which most npm packages use to specify their entry point. This is not a bug with esbuild because esbuild is just doing what it was told to do. However, people may do this without understanding how npm packages work, and then be confused about why it doesn't work. This release now includes additional information in the error message:

     > foo.js:1:27: error: Could not resolve "events" (use "--platform=node" when building for node)
         1 │ var EventEmitter = require('events')
           ╵                            ~~~~~~~~
       node_modules/events/package.json:20:2: note: The "main" field was ignored because the list of main fields to use is currently set to []
        20 │   "main": "./events.js",
           ╵   ~~~~~~
    
  • Fix a tree-shaking bug with var exports (#8203;1739)

    This release fixes a bug where a variable named var exports = {} was incorrectly removed by tree-shaking (i.e. dead code elimination). The exports variable is a special variable in CommonJS modules that is automatically provided by the CommonJS runtime. CommonJS modules are transformed into something like this before being run:

    function(exports, module, require) {
      var exports = {}
    }
    

    So using var exports = {} should have the same effect as exports = {} because the variable exports should already be defined. However, esbuild was incorrectly overwriting the definition of the exports variable with the one provided by CommonJS. This release merges the definitions together so both are included, which fixes the bug.

  • Merge adjacent CSS selector rules with duplicate content (#8203;1755)

    With this release, esbuild will now merge adjacent selectors when minifying if they have the same content:

    /* Original code */
    a { color: red }
    b { color: red }
    
    /* Old output (with --minify) */
    a{color:red}b{color:red}
    
    /* New output (with --minify) */
    a,b{color:red}
    
  • Shorten top, right, bottom, left CSS property into inset when it is supported (#8203;1758)

    This release enables collapsing of inset related properties:

    /* Original code */
    div {
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
    }
    
    /* Output with "--minify-syntax" */
    div {
      inset: 0;
    }
    

    This minification rule is only enabled when inset property is supported by the target environment. Make sure to set esbuild's target setting correctly when minifying if the code will be running in an older environment (e.g. earlier than Chrome 87).

    This feature was contributed by @8203;sapphi-red.


Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by WhiteSource Renovate. View repository job log here.

Activity icon
delete
deleted time in 1 day ago
Activity icon
issue

privatenumber issue comment privatenumber/esbuild-loader

privatenumber
privatenumber

I change to the esbuild-loader but webpack cache doesn't seem to work

Bug description

Before I use esbuild-loader, webpack cache with the babel-loader is working. But when I change to use the esbuild, it doesn't work. And here is my config about esbuild.

  {
    test: /\.jsx?$/,
    exclude: /node_modules/,
    oneOf: [
      {
        test: filePath => {
          if (!filePath) {
            return false;
          }
          try {
            const fileContent = fs.readFileSync(filePath).toString();
            return !hasDecorator(fileContent);
          } catch (e) {
            return false;
          }
        },
        use: [
          {
            loader: 'esbuild-loader',
            options: {
              loader: 'jsx',
              target: 'es2015',
            },
          },
        ],
      },
      // esbuild-loader is not support the decorators, so I try to use babel to compile these file
      {
        use: [
          {
            loader: 'babel-loader',
            options: {
              presets: ['@babel/preset-env', '@babel/preset-react'],
              plugins: [
                '@babel/plugin-transform-runtime',
                ['@babel/plugin-proposal-decorators', { 'legacy': true }],
                ['@babel/plugin-proposal-optional-chaining', { 'loose': false }],
                ['@babel/plugin-proposal-class-properties', { 'loose': true }],
                ['@babel/plugin-proposal-private-methods', { 'loose': true }],
                ['@babel/plugin-proposal-private-property-in-object', { 'loose': true }],
              ],
            },
          },
        ],
      },
    ],

  },
  {
    test: /\.tsx?$/,
    loader: 'esbuild-loader',
    options: {
      loader: 'tsx',
      target: 'es2015',
      tsconfigRaw: require('../../tsconfig.json'),
    },
  },

But the webpack log seems to have cache the file, but when i try to build the project the second time with no change about webpack, it doesn't hit the cache

I‘m expecting a reply!😄

Reproduction

Hope for a solution.

Node.js package manager

yarn

Environment

MacOS 11.4
node 14.16
npm 6.14.11
webpack 5.51.1

Can you contribute a fix?

  • I’m interested in opening a pull request for this issue.
push

privatenumber push privatenumber/minification-benchmarks

privatenumber
privatenumber
privatenumber
privatenumber

Merge branch 'upgrade-deps-12-2' of github.com:privatenumber/minification-benchmarks into upgrade-deps-12-2

commit sha: 980406ee39d0baf8edcbf9cf6a612d96ff776055

push time in 2 days ago
push

privatenumber push privatenumber/minification-benchmarks

privatenumber
privatenumber

Merge branch 'upgrade-deps-12-2' of github.com:privatenumber/minification-benchmarks into upgrade-deps-12-2

commit sha: f70e56637b88854184036929cc73ad6b321f92ab

push time in 2 days ago
Previous