From 82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Apr 2017 03:09:25 +0200 Subject: Reorganize module loading. We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node. --- thirdparty/systemjs/docs/config-api.md | 292 --------------------------------- 1 file changed, 292 deletions(-) delete mode 100644 thirdparty/systemjs/docs/config-api.md (limited to 'thirdparty/systemjs/docs/config-api.md') diff --git a/thirdparty/systemjs/docs/config-api.md b/thirdparty/systemjs/docs/config-api.md deleted file mode 100644 index 6ef4c6b92..000000000 --- a/thirdparty/systemjs/docs/config-api.md +++ /dev/null @@ -1,292 +0,0 @@ -## Configuration API - -### Setting Configuration - -Once SystemJS has loaded, configuration can be set on SystemJS by using the configuration function `System.config`: - -```javascript -System.config({ - configA: {}, - configB: 'value' -}); -``` - -This is a helper function which normalizes configuration and sets configuration properties on the SystemJS instance. - -`System.config({ prop: 'value' })` is mostly equivalent to `System.prop = value` except that it will extend configuration objects, -and certain properties will be normalized to be stored correctly. - -For this reason it is usually advisable to use `System.config` instead of setting instance properties directly. - -### Configuration Options - -* [babelOptions](#babeloptions) -* [bundle](#bundle) -* [defaultJSExtensions](#defaultjsextensions) -* [depCache](#depcache) -* [map](#map) -* [meta](#meta) -* [packages](#packages) -* [paths](#paths) -* [traceurOptions](#traceuroptions) -* [transpiler](#transpiler) -* [typescriptOptions](#typescriptoptions) - -#### babelOptions -Type: `Object` -Default: `{}` - -Set the Babel transpiler options when [System.transpiler](#transpiler) is set to `babel`: - -```javascript -System.config({ - babelOptions: { - stage: 1 - } -}); -``` - -A list of options is available in the [Babel project documentation](https://babeljs.io/docs/usage/options/). - -#### bundle -Type: `Object` - -Bundles allow a collection of modules to be downloaded together as a package whenever any module from that collection is requested. -Useful for splitting an application into sub-modules for production. Use with the [SystemJS Builder](https://github.com/systemjs/builder). - -```javascript -System.config({ - bundles: { - bundleA: ['dependencyA', 'dependencyB'] - } -}); -``` - -In the above any require to `dependencyA` or `dependencyB` will first trigger a `System.import('bundleA')` before proceeding with the load of `dependencyA` or `dependencyB`. - -It is an alternative to including a script tag for a bundle in the page, useful for bundles that load dynamically where we want to trigger the bundle load automatically only when needed. - -The bundle itself is a module which contains named System.register and define calls as an output of the builder. The dependency names the bundles config lists should be the same names that are explicitly defined in the bundle. - -#### defaultJSExtensions - -Backwards-compatibility mode for the loader to automatically add '.js' extensions when not present to module requests. - -This allows code written for SystemJS 0.16 or less to work easily in the latest version: - -```javascript -System.defaultJSExtensions = true; - -// requests ./some/module.js instead -System.import('./some/module'); -``` - -Note that this is a compatibility property for transitioning to using explicit extensions and will be deprecated in future. - -#### depCache -Type: `Object` - -An alternative to bundling providing a solution to the latency issue of progressively loading dependencies. -When a module specified in depCache is loaded, asynchronous loading of its pre-cached dependency list begins in parallel. - -```javascript -System.config({ - depCache: { - moduleA: ['moduleB'], // moduleA depends on moduleB - moduleB: ['moduleC'] // moduleB depends on moduleC - } -}); - -// when we do this import, depCache knows we also need moduleB and moduleC, -// it then directly requests those modules as well as soon as we request moduleA -System.import('moduleA') -``` - -Over HTTP/2 this approach may be preferable as it allows files to be individually cached in the browser meaning bundle optimizations are no longer a concern. - -#### map -Type: `Object` - -The map option is similar to paths, but acts very early in the normalization process. It allows you to map a module alias to a -location or package: - -```javascript -System.config({ - map: { - jquery: '//code.jquery.com/jquery-2.1.4.min.js' - } -}); -``` - -```javascript -import $ from 'jquery'; - -``` - -In addition, a map also applies to any subpaths, making it suitable for package folders as well: - -```javascript -System.config({ - map: { - package: 'local/package' - } -}); -``` - -```javascript -// loads /local/package/path.js -System.import('package/path.js'); -``` - -> Note map configuration used to support contextual submaps but this has been deprecated for package configuration. - -#### meta -Type: `Object` -Default: `{}` - -Module meta provides an API for SystemJS to understand how to load modules correctly. - -Meta is how we set the module format of a module, or know how to shim dependencies of a global script. - -```javascript -System.config({ - meta: { - // meaning [baseURL]/vendor/angular.js when no other rules are present - // path is normalized using map and paths configuration - 'vendor/angular.js': { - format: 'global', // load this module as a global - exports: 'angular', // the global property to take as the module value - deps: [ - // dependencies to load before this module - 'jquery' - ] - } - } -}); -``` - -Wildcard meta is also supported and is additive from least to most specific match: - -```javascript -System.config({ - meta: { - '/vendor/*': { format: 'global' } - } -}); -``` - -* [`format`](module-formats.md): - Sets in what format the module is loaded. -* [`exports`](module-formats.md#exports): - For the `global` format, when automatic detection of exports is not enough, a custom exports meta value can be set. - This tells the loader what global name to use as the module's export value. -* [`deps`](module-formats.md#shim-dependencies): - Dependencies to load before this module. Goes through regular paths and map normalization. Only supported for the `cjs`, `amd` and `global` formats. -* [`globals`](module-formats.md#custom-globals): - A map of global names to module names that should be defined only for the execution of this module. - Enables use of legacy code that expects certain globals to be present. - Referenced modules automatically becomes dependencies. Only supported for the `cjs` and `global` formats. -* [`loader`](overview.md#plugin-loaders): - Set a loader for this meta path. -* [`sourceMap`](creating-plugins.md): - For plugin transpilers to set the source map of their transpilation. -* `scriptLoad`: Set to `true` to load the module using `