See https://github.com/meteor/meteor/pull/5562/files for a discussion. Basically Cordova doesn't really support
a) Urls with @'s in them
b) Urls that don't point to fixed commits.
As this branch allows both of the above (and our NPM support does reasonably handle a+b), we split the way we handle cordova + npm URLs a little.
Add a bundledJsCssUrlRewriteHook function, which takes in a function and applies it
to the URL. Do not allow this on Cordova (handle that by just not calling it on Cordova).
Reimplement the bundledJsCssPrefix as a call to this function.
We only got away with this because we later use _.values to iterate over
the elements of the array, which just happens to do the right thing when
the array is overloaded with object properties. The order of iteration was
even the same because object keys are enumerated in order of assignment,
but when you're working with an ordered list of files it's better to use
an array the normal way (for its elements rather than its properties).
Now that we include it in published packages (as
node_modules/.package.json) we don't want it to change on every npm
update, or else we'll have to spuriously update package versions.
(The next release with this fix will spuriously update package versions,
though!)
If $METEOR_BINARY_DEP_WORKAROUND is set, then when bundling for a
non-host platform (build/bundle/deploy commands only), if a package has
no server unibuild for the target architecture, use the host
architecture and replace the npm modules with a package.json and
npm-shrinkwrap.json. Also write out a top-level setup.sh script (inside
programs/server) which runs npm install in all such directories.
To support this, we make sure to save the package.json and
npm-shrinkwrap.json files in various intermediate directories in case we
need them later. (We put them inside node_modules because that is what
gets copied from source tree to isopack.)
1. Add `addAssets` API to `package.js`
2. Rename `getSourcesFunc` to `getFiles` in internal code
3. Changed `PackageAPI#sources` to `PackageAPI#files` with a new structure that
has separate objects for assets and sources
4. Added some tests for different error conditions
5. The same file can now be a source and an asset
If set, it assumes that all local packages are portable and can be
deployed to any platform.
If you are using this, you need to consistently use it every time you
run Meteor, not just when deploying. The first time you use it in a
project that has been used without it, you should run `meteor rebuild`.
Since server/.bundle_version.txt is mostly used to determine the node
version, writing it more directly can help too.
(Arguably this should be MIN_NODE_VERSION rather than process.version
but that value is not easily accessed.)
When we download a package that's only isopack-1, we're supposed to
write it as a "fat" isopack-1/isopack-2 package, by using the same
includePreCompilerPluginIsopackVersions flag used for publishing
packages. However, the internal representation of the "prelink" resource
contained in legacy packages didn't have a flag set that is later used
to see if includePreCompilerPluginIsopackVersions is allowed to be
effective. This meant that we'd download packages published as
isopack-1-only and save them as isopack-2-only. And then old meteor
releases would fail to use them.
Fixes#4923.
The compiler inserts code that imports the exports of used packages.
It's important that we don't do this for the exports of used
debugOnly and prodOnly packages, because the inserted code will
fail at runtime if the packages are not linked in because we aren't
in dev mode or aren't in prod mode.
It's very useful to be able to include code only in production. It's
useful for React integration, but presumably also for many apps.
* Add prodOnly boolean flag alongside debugOnly in Package.describe
* Packages the set prodOnly to true auto-depend on isobuild:prod-only
(making them error in the old tool where prodOnly isn't supported)
* The `includeDebug` boolean build option is replaced by a string
named buildMode, which can be 'development' or 'production', just
like minifyMode.
Tested by self-test.