Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-ng-hot-reload

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-ng-hot-reload - npm Package Compare versions

Comparing version 2.1.0-alpha001 to 2.1.0-alpha002

LICENSE

7

dist/index.d.ts

@@ -1,2 +0,5 @@

export default function (babel: any): {
import * as Babel from '@babel/core';
declare type BabelT = typeof Babel;
declare type PluginOptions = {};
export default function (babel: BabelT, options?: PluginOptions): {
name: string;

@@ -9,4 +12,6 @@ post(): void;

ImportDeclaration(path: any): void;
ExportNamedDeclaration(path: any): void;
ExportDefaultDeclaration(path: any): void;
};
};
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function default_1(babel) {
function default_1(babel, options = {}) {
const { types: t } = babel;

@@ -116,7 +116,69 @@ const state = {

},
ExportNamedDeclaration(path) {
const declaration = path.get('declaration');
if (declaration.node !== null) {
if (declaration.type === 'VariableDeclaration') {
// Export variable declaration
// e.g:
// export const foo = 'bar',
// bar = 'foo';
const { declarations } = declaration.node;
declarations.forEach(declaration => {
const identifier = declaration.id;
state.topLevelExports.set(identifier.name, identifier);
});
}
else {
// Export right before declaration
// e.g:
// export class Foo {};
const identifier = declaration.get('id').node;
state.topLevelExports.set(identifier.name, identifier);
}
// Replace the export declaration with the actual declaration
path.replaceWith(declaration);
}
else {
// Export specifier
// e.g:
// const foo = 'bar';
// const bar = 'foo';
// export { foo, bar as bar2 };
const { specifiers } = path.node;
if (specifiers && specifiers.length > 0) {
specifiers.forEach(({ local, exported }) => {
state.topLevelExports.set(exported.name, local);
});
}
// Remove the export
path.remove();
}
},
ExportDefaultDeclaration(path) {
const node = path.node;
const name = node.declaration.name;
state.topLevelExports.set('default', path.get('declaration').node);
path.remove();
const declaration = path.get('declaration');
if (declaration.type === 'Identifier' || declaration.type === 'MemberExpression') {
// If export is a simple identifier we can use the node directly
//
// Identifier:
// const foo = 'bar';
// export default foo;
//
// MemberExpression:
// const obj = {
// foo: 'bar'
// };
// export default obj.foo;
state.topLevelExports.set('default', declaration.node);
// Remove the default export
path.remove();
}
else {
// If we have a declaration in the default export we have to get the
// identifier through the `id` property
// e.g:
// export default class Foo {}
state.topLevelExports.set('default', declaration.get('id').node);
// Replace the export declaration with the actual declaration
path.replaceWith(declaration);
}
},

@@ -123,0 +185,0 @@ },

{
"name": "babel-plugin-ng-hot-reload",
"version": "2.1.0-alpha001",
"version": "2.1.0-alpha002",
"main": "dist/index.js",
"author": {
"name": "Felix Haus",
"email": "felixhaus@gmail.com",
"url": "https://felix.house/"
},
"repository": {
"type": "git",
"url": "https://github.com/ofhouse/babel-plugin-ng-hot-reload.git"
},
"license": "MIT",
"scripts": {
"prepack": "tsc",
"build": "tsc",
"prepack": "cp ../../README.md ../../LICENSE ./ && tsc --p tsconfig.build.json",
"postpack": "rm ./README.md ./LICENSE",
"build": "tsc --p tsconfig.build.json",
"watch": "tsc -w",
"test": "mocha"
"test": "jest"
},

@@ -19,6 +29,11 @@ "dependencies": {

"devDependencies": {
"@babel/core": "^7.7.4",
"@types/babel__core": "^7.1.3",
"@types/jest": "^24.0.23",
"@types/node": "^12.12.12",
"jest": "^24.9.0",
"jest-snapshot-serializer-raw": "^1.1.0",
"ts-jest": "^24.2.0",
"typescript": "^3.7.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc