babel-plugin-ng-hot-reload
Advanced tools
Comparing version 2.1.0-alpha005 to 2.1.0-alpha006
@@ -0,1 +1,5 @@ | ||
/** | ||
* Note: Please make sure to only use syntax which is compatible with IE11 here | ||
* because the transformation runs after @babel/env! | ||
*/ | ||
import * as Babel from '@babel/core'; | ||
@@ -2,0 +6,0 @@ declare type BabelT = typeof Babel; |
"use strict"; | ||
/** | ||
* Note: Please make sure to only use syntax which is compatible with IE11 here | ||
* because the transformation runs after @babel/env! | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -15,7 +19,8 @@ function default_1(babel, { angularGlobal = false, forceRefresh = true, preserveState = true, angularReference = `require('angular'), angular`, }) { | ||
const EXPORTS_PREFIX = '__ngHotReload_'; | ||
const INNER_EXPORT_VARIABLE = '__ngHotReload_exports__'; | ||
const OUTER_EXPORT_VARIABLE = '__ngHotReload_outer_exports__'; | ||
const INNER_EXPORT_VARIABLE = '__ngHotReload_inner_exports__'; | ||
const ANGULAR_PACKAGE_NAME = 'angular'; | ||
const buildHotReloadTemplate = template(` | ||
/* babel-plugin-ng-hot-reload */ | ||
const %%extractedExports%% = (function(__ngHotReloadLoaderAngularGlobal) { | ||
var ${OUTER_EXPORT_VARIABLE} = (function(__ngHotReloadLoaderAngularGlobal) { | ||
var ${INNER_EXPORT_VARIABLE}; | ||
@@ -84,6 +89,9 @@ var angular = module.hot ? (function() { | ||
// -- | ||
// const { __export_default, __export_namedExport } = (function() {...})(); | ||
// var OUTER_EXPORT_VARIABLE = (function() {...})(); | ||
// | ||
// Appended to template: | ||
// -- | ||
// var __export_default = OUTER_EXPORT_VARIABLE.__export_default, | ||
// __export_namedExport = OUTER_EXPORT_VARIABLE.__export_namedExport; | ||
// | ||
// export { | ||
@@ -101,3 +109,3 @@ // __export_default as default, | ||
// Properties for the outer const destrcutor | ||
extractedExports.push(t.objectProperty(t.identifier(identifierKey), t.identifier(identifierKey), false, true)); | ||
extractedExports.push(t.variableDeclarator(t.identifier(identifierKey), t.memberExpression(t.identifier(OUTER_EXPORT_VARIABLE), t.identifier(identifierKey)))); | ||
// Restore the topLevelexports | ||
@@ -112,3 +120,2 @@ topLevelExports.push(t.exportSpecifier(t.identifier(identifierKey), t.identifier(key))); | ||
exports: exportsAsReturnStatement, | ||
extractedExports: t.objectPattern(extractedExports), | ||
}); | ||
@@ -118,2 +125,3 @@ const finalBody = [ | ||
hotReloadTemplateAst, | ||
extractedExports.length > 0 ? t.variableDeclaration('var', extractedExports) : undefined, | ||
topLevelExports.length > 0 ? t.exportNamedDeclaration(null, topLevelExports) : undefined, | ||
@@ -120,0 +128,0 @@ ...state.topLevelExportModule.values(), |
{ | ||
"name": "babel-plugin-ng-hot-reload", | ||
"version": "2.1.0-alpha005", | ||
"version": "2.1.0-alpha006", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -122,2 +122,8 @@ # 🔥 babel-plugin-ng-hot-reload | ||
### Lazy-loading with `oclazyload` | ||
This plugin also works with the lazy-loading library [ocLazyLoad](https://oclazyload.readme.io/). | ||
For an example check out the [Webpack / TypeScript example](./examples/typescript-webpack/). | ||
### Known issues with parcel | ||
@@ -132,2 +138,6 @@ | ||
### Browser-compability | ||
The plugin is compatible with the latest versions of Chrome, Firefox and IE11. | ||
## Author | ||
@@ -134,0 +144,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21018
270
153