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

WIP fix(bundler): fix commonjs node id compatibility. #831

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@huochunpeng
Contributor

huochunpeng commented Feb 27, 2018

Commonjs thinks "foo" and "foo.js" are same id, but AMD thinks they are two different ids. Passing nodeIdCompat: true to requirejs config to improve compatibility to whole range of commonjs packages. Ref: amodrojs/amodro-trace#7

fix(bundler): fix commonjs node id compatibility.
Commonjs thinks "foo" and "foo.js" are same id, but AMD thinks they are two different ids. Passing `nodeIdCompact: true` to requirejs config to improve compatibility to whole range of commonjs packages. Ref: amodrojs/amodro-trace#7
@huochunpeng

This comment has been minimized.

Show comment
Hide comment
@huochunpeng

huochunpeng Feb 27, 2018

Contributor

This solves date-fns bundling issue.

There is another issue related to date-fns.
au import date-fns doesn't work, the importer/strategies/amodro rejected it because of missing main in package.json.

I think it is quite safe to use "index.js" as the default value of package.main, because that's how nodejs deals with missing "main" anyway. @JeroenVinke I can make another PR if you agree to do so.

Contributor

huochunpeng commented Feb 27, 2018

This solves date-fns bundling issue.

There is another issue related to date-fns.
au import date-fns doesn't work, the importer/strategies/amodro rejected it because of missing main in package.json.

I think it is quite safe to use "index.js" as the default value of package.main, because that's how nodejs deals with missing "main" anyway. @JeroenVinke I can make another PR if you agree to do so.

@JeroenVinke

This comment has been minimized.

Show comment
Hide comment
@JeroenVinke

JeroenVinke Feb 28, 2018

Member

@huochunpeng thanks for the PR, i'll have a look

about using index.js as default, I think that should be fine since it's the last one, but I would prefer if we could check to see if that file exists before trying to execute the strategy

Member

JeroenVinke commented Feb 28, 2018

@huochunpeng thanks for the PR, i'll have a look

about using index.js as default, I think that should be fine since it's the last one, but I would prefer if we could check to see if that file exists before trying to execute the strategy

@huochunpeng

This comment has been minimized.

Show comment
Hide comment
@huochunpeng

huochunpeng Feb 28, 2018

Contributor

Sure, to ease my setup, I will create PR for that after this one is merged.

Contributor

huochunpeng commented Feb 28, 2018

Sure, to ease my setup, I will create PR for that after this one is merged.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Mar 10, 2018

fix(importer): support nodejs module default main file "index.js" whe…
…n "main" is missing in package.json

When "main" is missing in package.json, nodejs uses
default main file "index.js", it will complain when
default main file is missing.
This fix supports nodejs module with missing "main"
in package.json. It solves importing issue on nodejs
module "date-fns". aurelia#831 is related, that PR solves
tracing issue on "date-fns".
@huochunpeng

This comment has been minimized.

Show comment
Hide comment
@huochunpeng

huochunpeng Mar 25, 2018

Contributor

nodeIdCompat only fixes requrejs setup, not systemjs.

systemjs/systemjs#1807

Contributor

huochunpeng commented Mar 25, 2018

nodeIdCompat only fixes requrejs setup, not systemjs.

systemjs/systemjs#1807

@huochunpeng huochunpeng changed the title from fix(bundler): fix commonjs node id compatibility. to WIP fix(bundler): fix commonjs node id compatibility. Mar 26, 2018

@huochunpeng

This comment has been minimized.

Show comment
Hide comment
@huochunpeng

huochunpeng Mar 26, 2018

Contributor

There is complication in test. All apps need to update aurelia-karma.js in order to run test normally.
Which means this is a breaking change.

Plus this doesn't help on systemjs setup.

I am working on a better solution.

Contributor

huochunpeng commented Mar 26, 2018

There is complication in test. All apps need to update aurelia-karma.js in order to run test normally.
Which means this is a breaking change.

Plus this doesn't help on systemjs setup.

I am working on a better solution.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Mar 30, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
cover all aurelia-webpack-plugin covers.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
solve node id compatibility issue aurelia#831 for both requirejs and systemjs.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
overtake webpack for simplicity and usability, with far less code/config.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace it with "lazyMain": true.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Mar 30, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
cover all aurelia-webpack-plugin covers.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
solve node id compatibility issue aurelia#831 for both requirejs and systemjs.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
overtake webpack for simplicity and usability, with far less code/config.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace it with "lazyMain": true.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Mar 30, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Mar 30, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true

huochunpeng added a commit to huochunpeng/cli that referenced this pull request May 18, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Jul 23, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Jul 24, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true
@huochunpeng

This comment has been minimized.

Show comment
Hide comment
@huochunpeng

huochunpeng Jul 25, 2018

Contributor

obsoleted by #862

Contributor

huochunpeng commented Jul 25, 2018

obsoleted by #862

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Jul 26, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Jul 31, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Aug 9, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Aug 24, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Aug 24, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Sep 13, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Sep 14, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Sep 25, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

huochunpeng added a commit to huochunpeng/cli that referenced this pull request Sep 27, 2018

feat(bundler): auto tracing for requirejs/systemjs
remove all lib/importer files.
remove most of amodro-tracing.
manual efficient js and html tracing for aurelia.
remove irrelevant tracing cache.
cover all aurelia-webpack-plugin covers, plus more edge cases.
more permissive, usage of PLATFORM.moduleName is NOT required.
almost zero manual maintenance of aurelia.json dependencies.
fix node id compatibility issue aurelia#831 for both requirejs and systemjs.
fix bundles moduleIds format for modules need plugin.
fix compatibility issue with yarn workspaces.
support npm package "main":"./lib" when main file is lib/index.js.
improve backwards compatibility by ignoring main:false.
simplify and reduce source code, but increase test coverge.
add "au run --watch --auto-install" for frictionless dev flow.
best guess on package manager 'yarn' to avoid 'npm i' error on yarn
controlled node_modules.
overtake webpack on simplicity, usability, compatibility and flexibility,
but probably not on performance.
perform slightly faster than existing amodro-trace + cache.

Supersede aurelia#853, aurelia#842, aurelia#831
BREAKING CHANGE: require minor user code change to support non-js main, like "main": "font-awesome.css"
BREAKING CHANGE: remove support of undocumented "main": false, replace with generic "lazyMain": true. But this is handled transparently without breaking user's existing app.

@huochunpeng huochunpeng deleted the huochunpeng:fix-commonjs-node-id-compatibility branch Oct 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment