Skip to content

Commit

Permalink
Minor code tweaks (after code review)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Jul 4, 2017
1 parent b5dfd1e commit 5306bab
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Declaration.js
@@ -1,5 +1,5 @@
import { blank, forOwn, keys } from './utils/object.js';
import { makeLegal, reservedWords } from './utils/identifier-helpers.js';
import { makeLegal, reservedWords } from './utils/identifierHelpers.js';
import { UNKNOWN } from './ast/values.js';

export default class Declaration {
Expand Down
2 changes: 1 addition & 1 deletion src/ExternalModule.js
@@ -1,5 +1,5 @@
import { blank } from './utils/object.js';
import { makeLegal } from './utils/identifier-helpers.js';
import { makeLegal } from './utils/identifierHelpers.js';
import { ExternalDeclaration } from './Declaration.js';

export default class ExternalModule {
Expand Down
2 changes: 1 addition & 1 deletion src/Module.js
Expand Up @@ -4,7 +4,7 @@ import { locate } from 'locate-character';
import { timeStart, timeEnd } from './utils/flushTime.js';
import { assign, blank, keys } from './utils/object.js';
import { basename, extname } from './utils/path.js';
import { makeLegal } from './utils/identifier-helpers.js';
import { makeLegal } from './utils/identifierHelpers.js';
import getCodeFrame from './utils/getCodeFrame.js';
import { SOURCEMAPPING_URL_RE } from './utils/sourceMappingURL.js';
import error from './utils/error.js';
Expand Down
2 changes: 1 addition & 1 deletion src/finalisers/amd.js
@@ -1,4 +1,4 @@
import { getName, quotePath } from '../utils/map-helpers.js';
import { getName, quotePath } from '../utils/mapHelpers.js';
import getInteropBlock from './shared/getInteropBlock.js';
import getExportBlock from './shared/getExportBlock.js';
import esModuleExport from './shared/esModuleExport.js';
Expand Down
12 changes: 6 additions & 6 deletions src/finalisers/iife.js
@@ -1,13 +1,13 @@
import { blank } from '../utils/object.js';
import { getName } from '../utils/map-helpers.js';
import { getName } from '../utils/mapHelpers.js';
import error from '../utils/error.js';
import getInteropBlock from './shared/getInteropBlock.js';
import getExportBlock from './shared/getExportBlock.js';
import getGlobalNameMaker from './shared/getGlobalNameMaker.js';
import { property, keypath } from './shared/sanitize.js';
import warnOnBuiltins from './shared/warnOnBuiltins.js';
import trimEmptyImports from './shared/trimEmptyImports.js';
import { isLegal } from '../utils/identifier-helpers.js';
import { isLegal } from '../utils/identifierHelpers.js';

function setupNamespace ( keypath ) {
const parts = keypath.split( '.' );
Expand All @@ -27,10 +27,10 @@ export default function iife ( bundle, magicString, { exportMode, indentString,
const globalNameMaker = getGlobalNameMaker( options.globals || blank(), bundle, 'null' );

const { extend, moduleName: name } = options;
const isNamespaced = name && ~name.indexOf( '.' );
const justVariable = !extend && !isNamespaced;
const isNamespaced = name && name.indexOf( '.' ) !== -1;
const possibleVariableAssignment = !extend && !isNamespaced;

if ( name && justVariable && !isLegal(name) ) {
if ( name && possibleVariableAssignment && !isLegal(name) ) {
error({
code: 'ILLEGAL_IDENTIFIER_AS_NAME',
message: `Given moduleName (${name}) is not legal JS identifier. If you need this you can try --extend option`
Expand Down Expand Up @@ -72,7 +72,7 @@ export default function iife ( bundle, magicString, { exportMode, indentString,

let wrapperOutro = `\n\n}(${dependencies}));`;

if (justVariable && exportMode === 'named') {
if (possibleVariableAssignment && exportMode === 'named') {
wrapperOutro = `\n\n${indentString}return exports;${wrapperOutro}`;
}

Expand Down
2 changes: 1 addition & 1 deletion src/finalisers/umd.js
@@ -1,5 +1,5 @@
import { blank } from '../utils/object.js';
import { getName, quotePath, req } from '../utils/map-helpers.js';
import { getName, quotePath, req } from '../utils/mapHelpers.js';
import error from '../utils/error.js';
import getInteropBlock from './shared/getInteropBlock.js';
import getExportBlock from './shared/getExportBlock.js';
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 5306bab

Please sign in to comment.