profile
viewpoint
Michael Jackson mjackson @ReactTraining Carlsbad, California https://mjackson.me Founder @ReactTraining, creator @unpkg. Thriller.

janl/mustache.js 14150

Minimal templating with {{mustaches}} in JavaScript

jaredpalmer/after.js 3835

Next.js-like framework for server-rendered React apps built with React Router

acdlite/redux-router 2330

Redux bindings for React Router – keep your router state inside your Redux store

dabit3/react-authentication-in-depth 57

Example of User Authentication using React with React Router and AWS Amplify

knowbody/react-router-docs 56

Rewrite of the React Router docs - work in progress

hassox/react_phx_stdio 41

Demo app rendering react on the server

alex88/heroku-buildpack-vips 32

Heroku buildpack with vips

mjackson/bufferedstream 27

A robust stream implementation for node.js and the browser

mjackson/bencode 14

Bencode library for PHP

mjackson/broccoli-rev 12

A Broccoli plugin for adding revision checksums to file names

startedmdx-js/mdx

started time in 12 days

startedsindresorhus/meow

started time in 21 days

push eventreach/reach.tech

Travis CI

commit sha b3d8e61a1f49da025038915756b569391ad5f6a6

Update reach-ui website https://travis-ci.com/reach/reach-ui/builds/182200074

view details

push time in 2 months

issue closedw9jds/firebase-action

Provide a tag so I don't have to build from master on every deploy

It'd be nice to have a tag to pull from instead of pulling and building from master on every build. On average my builds take 40-50 seconds to build the firebase action.

Is this possible? I know there are some other actions that I use that I don't have to build every time (actions/checkout, for example), but I've never published a GitHub Action myself so I'm not sure how to do it.

closed time in 2 months

mjackson

issue commentw9jds/firebase-action

Provide a tag so I don't have to build from master on every deploy

Thanks for the reply. Sounds like it'd require you to rewrite the action in JavaScript. I'll go ahead and close. Maybe I can just npm install firebase-tools and use that directly...

mjackson

comment created time in 2 months

IssuesEvent

issue commentmjackson/unpkg

Get metadata for all packages vs specific version

We could definitely provide an endpoint for versions, yes. In npm terms this data is typically provided in a "packument". I'll reopen for further discussion.

rajsite

comment created time in 2 months

issue commentReactTraining/history

Expose previous location when using history.listen

I've always thought of history.listen as more of an event emitter than a state machine. There are so many other tools for managing state (this.state/this.setState, useState, useReducer, etc).

I really don't want to throw another one on the pile 😅

andrewplummer

comment created time in 2 months

pull request commentReactTraining/history

Link method which prevent same locations in the history

Hey everyone, I just realized that I never commented on this issue when I closed it. Sorry about that!

For anyone who is wondering, I left an explanation in another issue about why I decided to leave this functionality out of the history library.

It basically boils down to this: history.push is just a substitute for window.history.pushState. It shouldn't try to be "smart" about doing e.g. a push vs. replace. If it did, we would lose something that the pushState API actually gives us, namely the ability to push the same URL onto the stack twice. There are valid use cases for doing so, and overloading the meaning of "push" in this library would just cause more issues and confusion.

However, the original concern is totally legit. This is why React Router's <Link> component is smart about this in v6 (currently in beta). If you take a look at the source, you'll notice that a <Link> uses a replace instead of a push when the URL is the same. I think this is the right place for this logic.

This way, history + React Router have parity with the DOM. Our history.push works exactly like window.history.pushState and React Router's <Link> works like a normal <a> element.

Again, my apologies for not following up here earlier! I definitely should have.

dabit1

comment created time in 2 months

issue closedReactTraining/history

Petition to re-open #570

There has been a long-standing issue going on 4 years about how this library will repeat pushState when navigating to the page the user is currently on. This is a nuisance to the user experience. That said, what would it take to get that PR merged and get this issue to bed? Even @mjackson agreed that it has been a nuisance.

The behavior of browser history is as follows:

User navigates to /page-1
User navigates to /page-2
User navigates to /page-2
The back button returns the user to /page-1, not /page-2

Re: #570

closed time in 2 months

juliancoleman

issue commentReactTraining/history

Petition to re-open #570

history.push should not behave differently from window.history.pushState. If pushState adds a new location to the history stack (it does) then history.push should do the same thing. It's not this library's responsibility to make sure you aren't pushing duplicate URLs to the stack. That is the responsibility of code that uses this library.

For example, if you're using React Router v6 (currently in beta), the <Link> component automatically detects if you're pushing to the same location and uses a replace instead of a push action to mimic what standard <a> elements do.

Hope that helps!

juliancoleman

comment created time in 2 months

issue openedw9jds/firebase-action

Provide a tag so I don't have to build from master on every deploy

It'd be nice to have a tag to pull from instead of pulling and building from master on every build. On average my builds take 40-50 seconds to build the firebase action.

Is this possible? I know there are some other actions that I use that I don't have to build every time (actions/checkout, for example), but I've never published a GitHub Action myself so I'm not sure how to do it.

created time in 2 months

issue openednpm/npm-v7-blog

[QUESTION] <title>

What / Why

<!-- Describe the request in detail --> I'm unsure if this is the right place to ask something like this, but I was just wondering if y'all had any plans to continue sorting the entries in package.json's dependencies (and devDependencies) in v7 after an npm add or npm remove. It was a handy side effect that I used to quickly scan my dependencies in the past, and I'm kinda missing it in v7.

Thanks for all the great work you do!

Where

<!-- Examples

  • npm enterprise
  • npm public registry
  • npm/<repository> -->
  • npm cli v7

Who

<!-- Examples

  • @npm/<team>
  • @<username> -->
  • n/a

References

<!-- Examples

  • Related to #0
  • Depends on #0
  • Blocked by #0 -->
  • n/a

created time in 2 months

push eventreach/reach.tech

Travis CI

commit sha 3f6f936bab18b788bf251cec5334c43eb20f0768

Update reach-ui website https://travis-ci.com/reach/reach-ui/builds/180877270

view details

push time in 2 months

issue closedReactTraining/history

Any way to pause listeners?

I have a use case in a React application where I need to manipulate history stack by

  • triggering history.goBack
  • and then history.replace right after

However, I would like to bypass the listener for the first history.goBack call such that the route doesn't get rendered unnecessarily.

Public API doesn't seem to offer this kind of functionality. Would you be open to consider adding a capability to pause listeners?

closed time in 2 months

donysukardi

issue commentReactTraining/history

Any way to pause listeners?

It should be pretty easy to do this using the public API. history.listen returns a function you can use to stop listening for new locations, so just surround your call to goBack with an unlisten followed by a history.listen call.

Otherwise, keep a variable around and just ignore the change yourself, like:

let isPaused = false;
history.listen(location => {
  if (!isPaused) handleLocationChange(location);
});

function handleLocationChange(location) {
  // ...
}

// Somewhere in your app code
isPaused = true;
history.goBack();
isPaused = false;
history.replace();
donysukardi

comment created time in 2 months

issue closedReactTraining/history

Expose previous location when using history.listen

I can't really understand why the previous location isn't exposed when using history.listen. This seems like critical information, especially given that route changes occur even on hash updates, which often need to be differentiated from actual route updates to determine whether or not to show a new screen.

closed time in 2 months

andrewplummer

issue commentReactTraining/history

Expose previous location when using history.listen

let prevLocation = history.location;
history.listen(location => {
  // Do whatever you want with the previous location here.
  prevLocation = location;
});
andrewplummer

comment created time in 2 months

issue commentReactTraining/history

Add engines to package.json

Is there a particular reason you need this? This isn't a node library, per se.

MichaelDeBoey

comment created time in 2 months

issue closedReactTraining/history

Page is refreshed by calling history.go(), while history.back() isn't

We have iframe based micro-frontends. There is a need of changing the state of the inside app from outside one without full-reloading of the inside one. There is <BrowserRouter /> which uses Native History API.

I have tested the behavior on single app without any iframes.

When I click anchors in the app, React router doesn't refresh the whole app, and replaces parts of the app. In my case -- it's pagination.

I can call window.history.back() and it will not trigger page refresh. The same, I can do window.history.go(-1) and it will not trigger page referesh.

Then I decided what if I make window.history.pushState(null, null, 'page/2') and call window.history.go() -- page will be refreshed from scratch.

I can solve my task by replacing BrowserRouter by Router and exposing history object to window.ReactRouterHistory, but I think it's too much, when I can do window.history.back() without a page refresh.

Is it a bug? Why the page is fully refreshed by go(), but isn't when go(-1)? Is there a proper way to do this?

Thank you!

closed time in 2 months

Carduelis

issue commentReactTraining/history

Page is refreshed by calling history.go(), while history.back() isn't

It sounds like you want this library to be something it's not. This library isn't meant to replace the browser's built-in history API. It's just a thin layer the router uses to communicate with the browser. But users are still free to call the browser's built-in methods however they wish.

Carduelis

comment created time in 2 months

issue commentReactTraining/history

History is not compatible with the use of <base/>

In case 1, keep in mind the <base> tag is only supposed to be used for relative URLs in the current document. So history.push('/foo/bar') should not use the <base href> since it is an absolute path, but history.push('foo') should. This is why you don't see the <base href> in the first result, but you do in the second.

In case 2, there's really not much we can do. We would have to temporarily remove the <base> element from the page to prevent pushState from navigating to the new domain.

StringEpsilon

comment created time in 2 months

push eventmjackson/unpkg

Michael Jackson

commit sha 92c1a4043f1e690676da63c12662182390587b05

Use node 12 runtime

view details

Michael Jackson

commit sha 9f44cbf0135ede5201115449debf3b7a34538921

Add idle_timeout to App Engine config

view details

push time in 2 months

issue commentrollup/rollup

Else branch follows the wrong if statement

Would someone mind explaining briefly what the bug is? I've looked at it, but I can't say for sure I understand how and why Rollup is modifying the code here.

Is it because the warning() call is a no-op in production, so that else block is empty? What does Rollup do in that scenario?

TrySound

comment created time in 2 months

push eventmjackson/unpkg

Michael Jackson

commit sha 9f44cbf0135ede5201115449debf3b7a34538921

Add idle_timeout to App Engine config

view details

push time in 2 months

push eventmjackson/unpkg

Michael Jackson

commit sha 92c1a4043f1e690676da63c12662182390587b05

Use node 12 runtime

view details

push time in 2 months

push eventmjackson/unpkg

Michael Jackson

commit sha fe833797e8dc47a57986801ac7102662ca7301d2

Use eslint-config-react-app

view details

Eric Rodrigues Pires

commit sha 5a574ec4645a29f5e77cfa59f8f2c28b7f7aacf7

Reflect origin in CORS Fixes #226

view details

dependabot[bot]

commit sha a50a353b64ad9af3e77cd92d63a548335af4fc26

Bump mixin-deep from 1.3.1 to 1.3.2 Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2. - [Release notes](https://github.com/jonschlinkert/mixin-deep/releases) - [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2) Signed-off-by: dependabot[bot] <support@github.com>

view details

Øystein Kjærnet

commit sha d16ea57fde47e5b5139d00a12debf451786df440

Revert "Reflect origin in CORS" This reverts commit 5a574ec4645a29f5e77cfa59f8f2c28b7f7aacf7.

view details

Christophe Querton

commit sha 98534453aa3d96726f4be35a7c67e90639b953d0

Updates GitHub link, seems like unpkg moved.

view details

Michael Jackson

commit sha 780d0076a1c0540d1dc6dd07be3476442b2d4fec

Update function name

view details

Michael Jackson

commit sha 6bab4325e1ebfa64500b76c235a9b1b4754aa479

Remove ./ from beginning of package.json main Fixes #241

view details

Sebastian Silbermann

commit sha ebe058b0927510d5f7cb93e71f7d8807b7b9cb52

Create FUNDING.yml

view details

Michael Jackson

commit sha 7215072c724348b8d40a710b06a538f97a5953f3

Add Google Cloud logo + sponsorship info - Also fixed some horizontal scrolling issues

view details

Michael Jackson

commit sha 33edf5beecd6e0346bf28b100063c6893f160866

Fixed some layout issues

view details

Michael Jackson

commit sha bb0b62943fb98d1976fa7f3026905ca58eee3e37

Margin tweak

view details

Michael Jackson

commit sha 78c9de2e0e091a2c9728f5d2f24c009c4b4599bd

Use NODE_ENV when building client bundles

view details

Michael Jackson

commit sha a50e52b5f4e43ad7650884b844c6f87d56bbee04

Fix build warnings

view details

Michael Jackson

commit sha 1811d1c7ff3415f5783d8b73de2ac2c21c3d7b76

Add current build id to footer

view details

Michael Jackson

commit sha b5d1b2232a82dde78ff1794cb5919b70f54ea6fb

Change funding to GitHub sponsors

view details

push time in 2 months

startedalangpierce/sucrase

started time in 2 months

startedImmutableWebApps/unpkg-immutable-example

started time in 2 months

startedsharkdp/bat

started time in 2 months

pull request commentfacebook/react

Nesting Fixture

Just a quick note here (already spoke with @gaearon about this on Twitter DM): This won't work with React Router v6+ because we don't expose context at all in the react-router package. The reason we did it in v5 was because changes in the context API required us to maintain a reference to the context object. But v6 uses hooks to access things on context instead of exposing the object itself.

gaearon

comment created time in 2 months

push eventmjackson/unpkg

Michael Jackson

commit sha b5d1b2232a82dde78ff1794cb5919b70f54ea6fb

Change funding to GitHub sponsors

view details

push time in 2 months

startedneoclide/coc.nvim

started time in 3 months

issue commentrollup/rollup

this.addWatchFile does not listen for new files added to a directory

I believe this may be fixed by listening for the add event (in addition to the change and unlink events) in the file watcher here, but I'm not familiar enough with the code to be sure. FWIW I cloned the repo and was going to fix the bug myself but I couldn't get all tests to pass locally.

mjackson

comment created time in 3 months

push eventmjackson/rollup-watch-dir

Michael Jackson

commit sha 156c4c81478448577082a2c1d21df0878b4b45c7

Initial commit

view details

push time in 3 months

issue openedrollup/rollup

this.addWatchFile does not listen for new files added to a directory

<!-- ⚡️ katchow! We 💛 issues.

Please - do not - remove this template. Please - do not - skip or remove parts of this template. Or your issue may be closed.

👉🏽 Need help or tech support? Please don't open an issue! Head to https://gitter.im/rollup/rollup or https://stackoverflow.com/questions/tagged/rollupjs

👉🏽 Is this issue related to an official plugin? Please do not open an issue here, go to the plugins repository instead: https://github.com/rollup/plugins/issues

❤️ Rollup? Please consider supporting our collective: 👉 https://opencollective.com/rollup/donate -->

  • Rollup Version: 2.23.0
  • Operating System (or Browser): macos
  • Node Version (if applicable): 14.3.0
  • Link to reproduction (IMPORTANT, read below): https://github.com/mjackson/rollup-watch-dir

<!-- Issues without minimal reproductions will be closed! Please provide a link to one by:

  1. Using the REPL at https://rollupjs.org/repl/, or
  2. Using the REPL.it reproduction template at https://repl.it/@rollup/rollup-repro (allows full use of all rollup options and plugins), or
  3. Provide a minimal repository link (Read https://git.io/fNzHA for instructions). These may take more time to triage than the other options.

For some bugs it this may seem like overkill but believe us, very often what seems like a "clear issue" is actually specific to some details of your setup. Having a runnable reproduction not only "proves" your bug to us but also allows us to spend all our effort fixing the bug instead of struggling to understand your issue. -->

Expected Behavior

I'm expecting a rebuild when a new file is added to a directory that was passed to this.addWatchFile.

Actual Behavior

New files do not trigger a rebuild.

<!-- Most issues can be expressed or demonstrated through the REPL or a repository. However, the situation may arise where some small code snippets also need to be provided. In that situation, please add your code below using Fenced Code Blocks (https://help.github.com/articles/creating-and-highlighting-code-blocks/) -->

created time in 3 months

push eventmjackson/rollup-watch-dir

Michael Jackson

commit sha 7108b2074958f4675b3e240475e65f2850a1c966

Initial commit

view details

push time in 3 months

create barnchmjackson/rollup-watch-dir

branch : master

created branch time in 3 months

created repositorymjackson/rollup-watch-dir

created time in 3 months

fork mjackson/rollup

Next-generation ES module bundler

https://rollupjs.org

fork in 3 months

issue commentreach/reach-ui

CI builds are slow

One of the main things I did in the router repo to speed up testing and builds was to ditch lerna workspace run (or whatever it's called, can't remember). All the build + test infrastructure is able to work with the monorepo format, so e.g. I only have a single instance of Jest/Rollup running when I need to test/build. This eliminates startup time for spinning up individual processes, which can be significant in a repo with many packages.

mjackson

comment created time in 3 months

issue commentrollup/plugins

[pluginutils] strange behavior for include/exclude pattern

I ran into this same issue today which really confused me for a while. I am trying to use an absolute path as my include value which works with minimatch, but doesn't work with createFilter.

f = createFilter('/a/b/**/*')
f('/a/b/c.js') // false

minimatch.match(['/a/b/c.js'], '/a/b/**/*') // ['/a/b/c.js']

IMO this could be fixed by adding support for absolute paths in include and exclude, so I'm 👍 on adding support for a leading /.

The workaround for me for now involves using path.relative just so I can get a relative path that will then be resolved correctly...

LarsDenBakker

comment created time in 3 months

create barnchmjackson/rollup-id-split

branch : master

created branch time in 3 months

created repositorymjackson/rollup-id-split

created time in 3 months

issue commentmicrosoft/TypeScript

Revisiting _ underscore for unused parameters: create `unused` type

At the very least, a function parameter should not be considered to be "unused" if a parameter that comes after it is used. In that case, the "unused" parameter is actually serving a purpose by taking up a slot in the argument list.

function fun(a, b) {
  // The `a` parameter should not be considered "unused"
  console.log(b);
}
aryzing

comment created time in 3 months

more