Skip to content
This repository has been archived by the owner on Feb 15, 2018. It is now read-only.

Commit

Permalink
[JENKINS-37006] Change bundle generation to map/import via bundle ent…
Browse files Browse the repository at this point in the history
…ry rewriting (#5)

* refactor bundle generation code from index.js to internal/bundlegen.js

* bundle map entry stub rewriting

* Revert use of --ignore browserify option ... no use to us

... because it puts in one bundle map entry for all ignored modules (when there are multiple of them), pointing require at the same map entry for them all ... that's no use to us as we need a stub for each module

* Enhance require-stub-transform to do module pruning

... after mappings have left modules unused

* No need to rewrite module source when bundle mpa entry already removed (unused)

* throw new Error

* don't apply imports on "--no-imports"

* Added warning for duplicate require mappings

* rename withExternalModuleMapping to import

and deprcated withExternalModuleMapping

* Add export dependency builder code

.. still need to use that in the generated bundle

* Use a handlebars template to transform/wrap the entry module

* export-module.hbs handlebars template

* dependency exports

* Updates to reflect changes in js-modules to handle version ranges etc

* Mode tweaks to get bundling working with new module loading

* require-stub-transform cleanups

* bundle as to use a ModuleSpec

* Fixed dep export when no imports

* Added postBundle listener support

* Only allow global exports when there's one bundle being generated

* Remerge Cliff's changes for .babelrc

* Better import message

* Remove dependency on window-handle

* Added node_module to moduleDef

* post transform map  of fullPaths to ids

* 36-beta25

* Readded the --full-paths option

* nodeModulesRelPath function

* Support for import aliases

* Version updates for 0.0.37 release
  • Loading branch information
tfennelly committed Aug 24, 2016
1 parent da4d206 commit 12e8944
Show file tree
Hide file tree
Showing 26 changed files with 1,337 additions and 426 deletions.
10 changes: 5 additions & 5 deletions gulpfile.js
Expand Up @@ -7,9 +7,9 @@ builder.src(['./internal', './js']);

// Create a mock bundle for abcxyz:abcxyzV2. We then use
// this for testing the global withExternalModuleMapping
builder.bundle('spec/abcxyzV2.js').export('abcxyz');
builder.bundle('spec/abcxyzV2.js').namespace('abcxyz');

builder.withExternalModuleMapping('abcxyz', 'abcxyz:abcxyzV2');
builder.import('abcxyz', 'abcxyz:abcxyzV2');

// Create some test bundles and check them in the specs

Expand All @@ -21,13 +21,13 @@ builder.bundle('spec/testmodule.js', 'testmodule_1')
// - Has import
// - No use of default CSS
builder.bundle('spec/testmodule.js', 'testmodule_2')
.withExternalModuleMapping('underscore.string')
.import('underscore.string')
.inDir('target/testmodule');

// - Has import
// - Has use of default CSS
builder.bundle('spec/testmodule.js', 'testmodule_3')
.withExternalModuleMapping('underscore.string', {addDefaultCSS: true})
.import('underscore.string', {addDefaultCSS: true})
.inDir('target/testmodule')
.generateNoImportsBundle();

Expand All @@ -37,5 +37,5 @@ builder.bundle('spec/frameworky/style.less');

// An externalized package where the name has an NPM org in it
builder.bundle('spec/testmodule.js', 'testmodule_ext_org')
.withExternalModuleMapping('@jenkins-cd/js-modules')
.import('@jenkins-cd/js-modules')
.inDir('target/testmodule');

0 comments on commit 12e8944

Please sign in to comment.