Consistent Web Workers in browser and Node.
GoogleChromeLabs/tooling.report 826
tooling.report a quick way to determine the best build tool for your next web project, or if tooling migration is worth it, or how to adopt a tool's best practice into your existing configuration and code base.
The WebAssembly Pre-Initializer
Optimized Webpack Bundling for Everyone. Intro ⤵️
alexisvincent/systemjs-hot-reloader 228
reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
This is a grunt task for adding a grunt task to compiler ES6 JS into ES3 JS using Traceur Compiler
JavaScript tooling for working with WebAssembly Components
bytecodealliance/componentize-js 88
JS -> WebAssembly Component
JSX loader plugin
Virtual implementations of WASI APIs
issue commentguybedford/chomp
Chomp fails to install on Alpine via npm
Ah, yeah this sounds like an issue that we don't support Alpine builds.
I would suggest cargo install chompbuild
in this case.
comment created time in 2 days
issue commentbytecodealliance/componentize-js
Question - Importing Resources panics with `no entry found for key`
Thanks for posting. Yes resources have not been implemented in this project yet. It was top of my list until it wasn't! Will leave this one open to track.
comment created time in 3 days
pull request commentnodejs/node
esm: `--experimental-type` flag to flip module defaults
I've posted a follow-up comment on the naming discussion in https://github.com/nodejs/node/issues/49541#issuecomment-1738235575.
comment created time in 3 days
issue commentnodejs/node
Discussion: Name of the flag for the “ESM by default” mode
To reiterate my concern about the name here - having a flag that does not do what it sounds like it does is a recipe for user confusion. If I see a flag called --experimental-type=module
and run node --experimental-type=module x.js
where depending on various complex rules I don't understand it may or may not actually execute the module under that type, creates a very bad user experience by setting up the possibility for a confusion leading to a mismatch between expectations and the actual model.
Therefore my request is that we use any name other than --experimental-type
or --type
. Both --default-type
and --implicit-type
are fine by me.
Since this is now blocking https://github.com/nodejs/node/pull/49869, and @GeoffreyBooth is unable to change the PR without consensus, I would like to ask those participating here to urgently help in finding consensus on a suitable name.
Those who have already voted for --type
(@JakobJingleheimer ?) can you clarify if you would be able to change your opinion?
And if anyone has strong opinions for or against here please do share, since not knowing which alternatives are viable is hindering progress currently.
comment created time in 3 days
issue commentnodejs/node
Discussion: Name of the flag for the “ESM by default” mode
--implicit-type
would also work for me here in being a qualifying name. If we want short flags, we could add a short flag alias for the module value or similar.
comment created time in 4 days
issue commentnodejs/node
Discussion: Name of the flag for the “ESM by default” mode
I don’t think of this as any different than the type field itself.
I understand the reasoning you're making, but it's still not a strong argument to me. We should evaluate the clarity of the name on its own merits not relatively.
--experimental-default-type
remains my preference for clarity.
comment created time in 4 days
Pull request review commentnodejs/node
esm: `--experimental-type` flag to flip module defaults
function extname(url) { return ''; } +/**+ * Determine whether the given file URL is under a `node_modules` folder.+ * This function assumes that the input has already been verified to be a `file:` URL,+ * and is a file rather than a folder.+ * @param {URL} url+ */+function underNodeModules(url) {+ return StringPrototypeIndexOf(url.pathname, '/node_modules/') !== -1;+}
Okay, let's start with this version, and iterate with feedback if we need to.
comment created time in 4 days
issue commentnodejs/node
Discussion: Name of the flag for the “ESM by default” mode
the default value of --default-type is now module
Semantically this is entirely correct in it being a default of a default, but you would usually just say the "default type" is now module.
My concern specifically was about users wondering why node --experimental-type=commonjs x.js
doesn't work when you have a package.json of "type": "module"
. Thinking of it as setting the type is definitely wrong and confusing, as it is very much setting a default.
comment created time in 4 days
issue commentWebAssembly/component-model
Inferring import kind from string syntax
Very interesting discussion, reimagining packaging conventions is surprisingly hard, as it becomes clear how much really is just convention over specification and how much cross-interaction there is to consider.
I like the sentiment of simplifying on strings. One problem with overloading the strings too much is that normalization starts to become a little more ill-defined. The unstructured nature of the string still requires parsing, resolution and normalization operations in tooling, and so structure and convention is very quickly needed again.
If seeking to reduce structure, a middle ground might be tagged strings + arbitrary structured key / value metadata:
Starting with the existing example:
(import "foo" (func ...))
(import "interface(foo:bar/baz)" (func ...))
(import "contents(integrity=xx)" (func ...))
(import "url(xx, integrity=xx)" (func ...))
(import "relative-url(foo, integrity=xx)" (func ...))
(import "locked-dep(foo:bar/baz, integrity=xx)" (func ...))
(import "unlocked-dep(foo:bar/baz)" (func ...))
Then expressing that in the spec primitivies of tagged strings (name | id | url
) and arbitrary attributes:
(import (name "foo") (func ...)) ; kebab name
(import (id "foo:bar/baz") (func ...)) ; IDs as distinct from names and URLs
(import (url "sha256:xx") (func ...)) ; content addressing integrity via URL-like conventions
(import (url "xx") (attr integrity "xx") (func ...)) ; integrity is an attribute if not content-addressing
(import (url "foo") (attr integrity "xx") (func ...)) ; relative url is still a url
(import (id "foo:bar/baz@1.2.3") (attr integrity xx) (func ...)) ; locked deps as fully constrained ids with exact versions
(import (id "foo:bar/baz") (attr constraint "^1.2") (func ...)) ; unlocked deps as non-exact ids with constraints
The important point is the spec doesn't need to specify the conventions and details, just that there are tagged strings and attributes of the formst:
name | id | url
string: the kebab name, interface name, absolute or relative url depending on which case applies. Structure could possibly even be simplified further to just be strings without tagging via conventional string parsing rules, where ids are a subset of URLs of sorts.- Non-identifying key / value metadata attributes for imports only: do not form part of the instantiation argument, do not form part of the identity, but can be used to authoritatively drive linking and resolution information. The encoding as just a list of arbitrary key value string pairs.
While metadata keys can be arbitrary, we already have a bunch defined so then as conventions emerge they can be explicitly specified and reserved for very specific scenarios. The benefit of metadata attributes then being able to balance having some structure while evolving conventions over time as needed.
comment created time in 4 days
Pull request review commentnodejs/node
esm: `--experimental-type` flag to flip module defaults
function mimeToFormat(mime) { return null; } +/**+ * For extensionless files in a `module` package scope, or a default `module` scope enabled by the `--experimental-type`+ * flag, we check the file contents to disambiguate between ES module JavaScript and Wasm.+ * We do this by taking advantage of the fact that all Wasm files start with the header `0x00 0x61 0x73 0x6d` (`_asm`).+ * @param {URL} url+ */+function getFormatOfExtensionlessFile(url) {+ if (!experimentalWasmModules) { return 'module'; }++ const magic = new Uint8Array(4);+ let fd;+ try {+ fd = openSync(url);+ readSync(fd, magic, 0, 4); // Only read the first four bytes+ if (magic[0] === 0x00 && magic[1] === 0x61 && magic[2] === 0x73 && magic[3] === 0x6d) {+ return 'wasm';+ }
Are you referring to the validation here? Validation of the entire binary seems like it may incur an unnecessary performance cost when the magic bytes \0asm
are already sufficient.
comment created time in 5 days
Pull request review commentnodejs/node
esm: `--experimental-type` flag to flip module defaults
function extname(url) { return ''; } +/**+ * Determine whether the given file URL is under a `node_modules` folder.+ * This function assumes that the input has already been verified to be a `file:` URL,+ * and is a file rather than a folder.+ * @param {URL} url+ */+function underNodeModules(url) {+ return StringPrototypeIndexOf(url.pathname, '/node_modules/') !== -1;
The URL at this position would be fully normalized, so that ..
segments cannot appear. I posted before reading your comments, but address the case you just brought up in https://github.com/nodejs/node/pull/49869#discussion_r1336530325.
comment created time in 5 days
Pull request review commentnodejs/node
esm: `--experimental-type` flag to flip module defaults
function extname(url) { return ''; } +/**+ * Determine whether the given file URL is under a `node_modules` folder.+ * This function assumes that the input has already been verified to be a `file:` URL,+ * and is a file rather than a folder.+ * @param {URL} url+ */+function underNodeModules(url) {+ return StringPrototypeIndexOf(url.pathname, '/node_modules/') !== -1;+}
While there are still various edge cases here, overall this seems like the right kind of tradeoff to me, especially considering this will be an opt-in experimental flag.
If there are any concerns about cases where developers happen to be nesting node_modules for whatever reason, I just wanted to note that there could be a slightly more constrained version of this check based on the following rules:
- Apply getPackageBase to the
url
to get the package.json base - If that package.json file is not the base of a package - ie it is not the
node_modules/pkg/package.json
ornode_modules/@pkg/scope/package.json
file, then we could allow switching that default, so that an inner package.json might also be covered by the switch
Could be worth considering depending on how the feedback goes.
comment created time in 5 days
Pull request review commentnodejs/node
esm: `--experimental-type` flag to flip module defaults
'use strict';+ const { RegExpPrototypeExec, ObjectPrototypeHasOwnProperty, PromisePrototypeThen, PromiseResolve,+ StringPrototypeIndexOf, StringPrototypeCharCodeAt, StringPrototypeSlice, } = primordials; const { basename, relative } = require('path'); const { getOptionValue } = require('internal/options'); const { extensionFormatMap,+ getFormatOfExtensionlessFile, mimeToFormat, } = require('internal/modules/esm/formats'); const experimentalNetworkImports = getOptionValue('--experimental-network-imports');+const typeFlag = getOptionValue('--experimental-type');+// The next line is where we flip the default to ES modules someday.+const defaultType = typeFlag === 'module' ? 'module' : 'commonjs';
This seems to be the better naming IMO. Using the term "default" to describe this mode switch I think may be much more clarifying since this doesn't override existing configurations.
comment created time in 5 days
push eventjspm/generator
commit sha c1c3ebddda5c04197542e4026a81755aa1afdba6
guard against a missing process.env (as in the browser) (#322)
push time in 5 days
PR merged jspm/generator
When there's no process.env, the check above fails. This just guards it.
pr closed time in 5 days
issue commentjspm/generator.jspm.io
Thanks for posting, agreed we should add a button or figure out how best to integrate in this case. Contributions welcome.
comment created time in 7 days
pull request commentjspm/jspm-cli
(feat): Add build command by wrapping rollup
Also documentation should be added in https://github.com/jspm/jspm-cli/tree/main/docs, which would then get added to the site.
comment created time in 7 days
Pull request review commentjspm/jspm-cli
(feat): Add build command by wrapping rollup
+import path from "node:path";+import process from "node:process";+import fs from "node:fs/promises";+import { type RollupOptions, rollup } from "rollup";++import { JspmError, exists } from "../utils";+import type { Flags } from "../types";+import { RollupImportmapPlugin } from "./rollup-importmap-plugin";++export default async function build(flags: Flags) {+ if (!flags.entry && !flags.buildConfig) {+ throw new JspmError(`Please provide entry for the build`);+ }++ let buildConfig: RollupOptions;+ let outputOptions: RollupOptions["output"];++ if (flags.entry) {
What happens if entry is not provided? Surely we always need one?
comment created time in 7 days