diff --git a/.eslintrc.js b/.eslintrc.js index f03eac32f..7b49ebdb0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,6 +9,7 @@ module.exports = { }, parserOptions: { sourceType: 'module', + ecmaVersion: 2022, }, rules: { 'no-console': 'warn', diff --git a/Gruntfile.js b/Gruntfile.js index bae78c8cc..76af9b40a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -49,7 +49,7 @@ module.exports = function (grunt) { { cwd: 'lib/', expand: true, - src: '**/!(index).js', + src: '**/*.js', dest: 'dist/cjs/', }, ], @@ -65,13 +65,13 @@ module.exports = function (grunt) { }, }, handlebars: { - entry: './dist/cjs/handlebars.js', + entry: './dist/cjs/handlebars/index.js', output: { filename: 'handlebars.js', }, }, runtime: { - entry: './dist/cjs/handlebars.runtime.js', + entry: './dist/cjs/handlebars/index.runtime.js', output: { filename: 'handlebars.runtime.js', }, diff --git a/lib/.eslintrc.js b/lib/.eslintrc.cjs similarity index 100% rename from lib/.eslintrc.js rename to lib/.eslintrc.cjs diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 371398f4a..c4b5be26e 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -1,9 +1,11 @@ -import { Exception } from '@handlebars/parser'; -import { createFrame, extend, toString } from './utils'; -import { registerDefaultHelpers } from './helpers'; -import { registerDefaultDecorators } from './decorators'; -import logger from './logger'; -import { resetLoggedProperties } from './internal/proto-access'; +import * as parser from '@handlebars/parser'; +import { createFrame, extend, toString } from './utils.js'; +import { registerDefaultHelpers } from './helpers.js'; +import { registerDefaultDecorators } from './decorators.js'; +import logger from './logger.js'; +import { resetLoggedProperties } from './internal/proto-access.js'; + +const Exception = parser.Exception ?? parser.default.Exception; export const VERSION = '4.7.7'; export const COMPILER_REVISION = 8; diff --git a/lib/handlebars/compiler/code-gen.js b/lib/handlebars/compiler/code-gen.js index 2d03e9798..b26b9ceab 100644 --- a/lib/handlebars/compiler/code-gen.js +++ b/lib/handlebars/compiler/code-gen.js @@ -1,50 +1,6 @@ -/* global define */ -import { isArray } from '../utils'; - -let SourceNode; - -try { - /* istanbul ignore next */ - if (typeof define !== 'function' || !define.amd) { - // We don't support this in AMD environments. For these environments, we assume that - // they are running on the browser and thus have no need for the source-map library. - let SourceMap = require('source-map'); // eslint-disable-line no-undef - SourceNode = SourceMap.SourceNode; - } -} catch (err) { - /* NOP */ -} +import { SourceNode } from '#source-map'; -/* istanbul ignore if: tested but not covered in istanbul due to dist build */ -if (!SourceNode) { - SourceNode = function (line, column, srcFile, chunks) { - this.src = ''; - if (chunks) { - this.add(chunks); - } - }; - /* istanbul ignore next */ - SourceNode.prototype = { - add: function (chunks) { - if (isArray(chunks)) { - chunks = chunks.join(''); - } - this.src += chunks; - }, - prepend: function (chunks) { - if (isArray(chunks)) { - chunks = chunks.join(''); - } - this.src = chunks + this.src; - }, - toStringWithSourceMap: function () { - return { code: this.toString() }; - }, - toString: function () { - return this.src; - }, - }; -} +import { isArray } from '../utils.js'; function castChunk(chunk, codeGen, loc) { if (isArray(chunk)) { diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index d68a0062d..85504c9a4 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -1,8 +1,10 @@ /* eslint-disable new-cap */ -import { Exception } from '@handlebars/parser'; -import { isArray, indexOf, extend } from '../utils'; -import AST from './ast'; +import * as parser from '@handlebars/parser'; +import { isArray, indexOf, extend } from '../utils.js'; +import AST from './ast.js'; + +const Exception = parser.Exception ?? parser.default.Exception; const slice = [].slice; diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 5a86e9a0d..5680733d0 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -1,7 +1,9 @@ -import { Exception } from '@handlebars/parser'; -import { COMPILER_REVISION, REVISION_CHANGES } from '../base'; -import { isArray } from '../utils'; -import CodeGen from './code-gen'; +import * as parser from '@handlebars/parser'; +import { COMPILER_REVISION, REVISION_CHANGES } from '../base.js'; +import { isArray } from '../utils.js'; +import CodeGen from './code-gen.js'; + +const Exception = parser.Exception ?? parser.default.Exception; function Literal(value) { this.value = value; diff --git a/lib/handlebars/compiler/source-map.js b/lib/handlebars/compiler/source-map.js new file mode 100644 index 000000000..ec444521b --- /dev/null +++ b/lib/handlebars/compiler/source-map.js @@ -0,0 +1,32 @@ +import { isArray } from '../utils.js'; + +/* istanbul ignore if: tested but not covered in istanbul due to dist build */ +const SourceNode = function (line, column, srcFile, chunks) { + this.src = ''; + if (chunks) { + this.add(chunks); + } +}; +/* istanbul ignore next */ +SourceNode.prototype = { + add: function (chunks) { + if (isArray(chunks)) { + chunks = chunks.join(''); + } + this.src += chunks; + }, + prepend: function (chunks) { + if (isArray(chunks)) { + chunks = chunks.join(''); + } + this.src = chunks + this.src; + }, + toStringWithSourceMap: function () { + return { code: this.toString() }; + }, + toString: function () { + return this.src; + }, +}; + +export { SourceNode }; diff --git a/lib/handlebars/decorators.js b/lib/handlebars/decorators.js index d9d5e8a96..7d7d209c3 100644 --- a/lib/handlebars/decorators.js +++ b/lib/handlebars/decorators.js @@ -1,4 +1,4 @@ -import registerInline from './decorators/inline'; +import registerInline from './decorators/inline.js'; export function registerDefaultDecorators(instance) { registerInline(instance); diff --git a/lib/handlebars/decorators/inline.js b/lib/handlebars/decorators/inline.js index fe7a437a0..60fe10a96 100644 --- a/lib/handlebars/decorators/inline.js +++ b/lib/handlebars/decorators/inline.js @@ -1,4 +1,4 @@ -import { extend } from '../utils'; +import { extend } from '../utils.js'; export default function (instance) { instance.registerDecorator( diff --git a/lib/handlebars/helpers.js b/lib/handlebars/helpers.js index 804796820..d13b5961a 100644 --- a/lib/handlebars/helpers.js +++ b/lib/handlebars/helpers.js @@ -1,10 +1,10 @@ -import registerBlockHelperMissing from './helpers/block-helper-missing'; -import registerEach from './helpers/each'; -import registerHelperMissing from './helpers/helper-missing'; -import registerIf from './helpers/if'; -import registerLog from './helpers/log'; -import registerLookup from './helpers/lookup'; -import registerWith from './helpers/with'; +import registerBlockHelperMissing from './helpers/block-helper-missing.js'; +import registerEach from './helpers/each.js'; +import registerHelperMissing from './helpers/helper-missing.js'; +import registerIf from './helpers/if.js'; +import registerLog from './helpers/log.js'; +import registerLookup from './helpers/lookup.js'; +import registerWith from './helpers/with.js'; export function registerDefaultHelpers(instance) { registerBlockHelperMissing(instance); diff --git a/lib/handlebars/helpers/block-helper-missing.js b/lib/handlebars/helpers/block-helper-missing.js index c9e1b7501..6071e0e02 100644 --- a/lib/handlebars/helpers/block-helper-missing.js +++ b/lib/handlebars/helpers/block-helper-missing.js @@ -1,4 +1,4 @@ -import { isArray } from '../utils'; +import { isArray } from '../utils.js'; export default function (instance) { instance.registerHelper('blockHelperMissing', function (context, options) { diff --git a/lib/handlebars/helpers/each.js b/lib/handlebars/helpers/each.js index c18f462a5..d23045e60 100644 --- a/lib/handlebars/helpers/each.js +++ b/lib/handlebars/helpers/each.js @@ -1,5 +1,7 @@ -import { Exception } from '@handlebars/parser'; -import { createFrame, isArray, isFunction, isMap, isSet } from '../utils'; +import * as parser from '@handlebars/parser'; +import { createFrame, isArray, isFunction, isMap, isSet } from '../utils.js'; + +const Exception = parser.Exception ?? parser.default.Exception; export default function (instance) { instance.registerHelper('each', function (context, options) { diff --git a/lib/handlebars/helpers/helper-missing.js b/lib/handlebars/helpers/helper-missing.js index c59a3206a..47ec9504b 100644 --- a/lib/handlebars/helpers/helper-missing.js +++ b/lib/handlebars/helpers/helper-missing.js @@ -1,4 +1,6 @@ -import { Exception } from '@handlebars/parser'; +import * as parser from '@handlebars/parser'; + +const Exception = parser.Exception ?? parser.default.Exception; export default function (instance) { instance.registerHelper('helperMissing', function (/* [args, ]options */) { diff --git a/lib/handlebars/helpers/if.js b/lib/handlebars/helpers/if.js index bb2f4dfaa..e67f9197e 100644 --- a/lib/handlebars/helpers/if.js +++ b/lib/handlebars/helpers/if.js @@ -1,5 +1,7 @@ -import { Exception } from '@handlebars/parser'; -import { isEmpty, isFunction } from '../utils'; +import * as parser from '@handlebars/parser'; +import { isEmpty, isFunction } from '../utils.js'; + +const Exception = parser.Exception ?? parser.default.Exception; export default function (instance) { instance.registerHelper('if', function (conditional, options) { diff --git a/lib/handlebars/helpers/with.js b/lib/handlebars/helpers/with.js index 908477bda..70fe464d2 100644 --- a/lib/handlebars/helpers/with.js +++ b/lib/handlebars/helpers/with.js @@ -1,5 +1,7 @@ -import { Exception } from '@handlebars/parser'; -import { isEmpty, isFunction } from '../utils'; +import * as parser from '@handlebars/parser'; +import { isEmpty, isFunction } from '../utils.js'; + +const Exception = parser.Exception ?? parser.default.Exception; export default function (instance) { instance.registerHelper('with', function (context, options) { diff --git a/lib/handlebars.js b/lib/handlebars/index.js similarity index 56% rename from lib/handlebars.js rename to lib/handlebars/index.js index 68a505a20..ccdcb5f75 100644 --- a/lib/handlebars.js +++ b/lib/handlebars/index.js @@ -1,18 +1,18 @@ -import { - parser as Parser, - parse, - parseWithoutProcessing, - Visitor, -} from '@handlebars/parser'; +import * as parser from '@handlebars/parser'; -import runtime from './handlebars.runtime'; +const { parse, parseWithoutProcessing } = parser; + +const Parser = parser.parser ?? parser.default.parser; +const Visitor = parser.Visitor ?? parser.default.Visitor; + +import runtime from './index.runtime.js'; // Compiler imports -import AST from './handlebars/compiler/ast'; -import { Compiler, compile, precompile } from './handlebars/compiler/compiler'; -import JavaScriptCompiler from './handlebars/compiler/javascript-compiler'; +import AST from './compiler/ast.js'; +import { Compiler, compile, precompile } from './compiler/compiler.js'; +import JavaScriptCompiler from './compiler/javascript-compiler.js'; -import noConflict from './handlebars/no-conflict'; +import noConflict from './no-conflict.js'; let _create = runtime.create; function create() { diff --git a/lib/handlebars.runtime.js b/lib/handlebars/index.runtime.js similarity index 64% rename from lib/handlebars.runtime.js rename to lib/handlebars/index.runtime.js index 9d33940f2..f31ab9c92 100644 --- a/lib/handlebars.runtime.js +++ b/lib/handlebars/index.runtime.js @@ -1,13 +1,17 @@ -import { Exception } from '@handlebars/parser'; -import * as base from './handlebars/base'; +import * as parser from '@handlebars/parser'; +import * as base from './base.js'; // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) -import SafeString from './handlebars/safe-string'; -import * as Utils from './handlebars/utils'; -import * as runtime from './handlebars/runtime'; +import SafeString from './safe-string.js'; +import * as Utils from './utils.js'; +import * as runtime from './runtime.js'; -import noConflict from './handlebars/no-conflict'; +import noConflict from './no-conflict.js'; + +const Exception = parser.Exception ?? parser.default.Exception; + +const vm = Utils.extend({}, runtime); // For compatibility and usage outside of module systems, make the Handlebars object a namespace function create() { @@ -19,7 +23,7 @@ function create() { hb.Utils = Utils; hb.escapeExpression = Utils.escapeExpression; - hb.VM = runtime; + hb.VM = vm; hb.template = function (spec) { return runtime.template(spec, hb); }; diff --git a/lib/handlebars/internal/create-new-lookup-object.js b/lib/handlebars/internal/create-new-lookup-object.js index 256f1eca1..8dadb9fd9 100644 --- a/lib/handlebars/internal/create-new-lookup-object.js +++ b/lib/handlebars/internal/create-new-lookup-object.js @@ -1,4 +1,4 @@ -import { extend } from '../utils'; +import { extend } from '../utils.js'; /** * Create a new object with "null"-prototype to avoid truthy results on prototype properties. diff --git a/lib/handlebars/internal/proto-access.js b/lib/handlebars/internal/proto-access.js index 9d19c23f7..bb933b4f8 100644 --- a/lib/handlebars/internal/proto-access.js +++ b/lib/handlebars/internal/proto-access.js @@ -1,5 +1,5 @@ -import { createNewLookupObject } from './create-new-lookup-object'; -import logger from '../logger'; +import { createNewLookupObject } from './create-new-lookup-object.js'; +import logger from '../logger.js'; const loggedProperties = Object.create(null); diff --git a/lib/handlebars/logger.js b/lib/handlebars/logger.js index a7022ef04..d8cdf1c5e 100644 --- a/lib/handlebars/logger.js +++ b/lib/handlebars/logger.js @@ -1,4 +1,4 @@ -import { indexOf } from './utils'; +import { indexOf } from './utils.js'; let logger = { methodMap: ['debug', 'info', 'warn', 'error'], diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index 49842c343..783c82410 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -1,17 +1,19 @@ -import { Exception } from '@handlebars/parser'; -import * as Utils from './utils'; +import * as parser from '@handlebars/parser'; +import * as Utils from './utils.js'; import { COMPILER_REVISION, createFrame, LAST_COMPATIBLE_COMPILER_REVISION, REVISION_CHANGES, -} from './base'; -import { moveHelperToHooks } from './helpers'; -import { wrapHelper } from './internal/wrapHelper'; +} from './base.js'; +import { moveHelperToHooks } from './helpers.js'; +import { wrapHelper } from './internal/wrapHelper.js'; import { createProtoAccessControl, resultIsAllowed, -} from './internal/proto-access'; +} from './internal/proto-access.js'; + +const Exception = parser.Exception ?? parser.default.Exception; export function checkRevision(compilerInfo) { const compilerRevision = (compilerInfo && compilerInfo[0]) || 1, diff --git a/lib/index.cjs b/lib/index.cjs new file mode 100644 index 000000000..ed0514e3d --- /dev/null +++ b/lib/index.cjs @@ -0,0 +1,2 @@ +/* eslint-env node */ +module.exports = require('../dist/cjs/index.js').default; diff --git a/lib/index.js b/lib/index.js index be8e69cd2..88768a533 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,26 +1,7 @@ -// USAGE: -// var handlebars = require('handlebars'); -/* eslint-env node */ -/* eslint-disable no-var */ +import handlebars from './handlebars/index.js'; +import { PrintVisitor, print } from '@handlebars/parser'; -// var local = handlebars.create(); +handlebars.PrintVisitor = PrintVisitor; +handlebars.print = print; -var handlebars = require('../dist/cjs/handlebars')['default']; - -var parser = require('@handlebars/parser'); -handlebars.PrintVisitor = parser.PrintVisitor; -handlebars.print = parser.print; - -module.exports = handlebars; - -// Publish a Node.js require() handler for .handlebars and .hbs files -function extension(module, filename) { - var fs = require('fs'); - var templateString = fs.readFileSync(filename, 'utf8'); - module.exports = handlebars.compile(templateString); -} -/* istanbul ignore else */ -if (typeof require !== 'undefined' && require.extensions) { - require.extensions['.handlebars'] = extension; - require.extensions['.hbs'] = extension; -} +export default handlebars; diff --git a/lib/index.runtime.cjs b/lib/index.runtime.cjs new file mode 100644 index 000000000..6c9c01feb --- /dev/null +++ b/lib/index.runtime.cjs @@ -0,0 +1,2 @@ +/* eslint-env node */ +module.exports = require('../dist/cjs/handlebars/index.runtime.js').default; diff --git a/lib/package.json b/lib/package.json new file mode 100644 index 000000000..c5441a396 --- /dev/null +++ b/lib/package.json @@ -0,0 +1,9 @@ +{ + "type": "module", + "imports": { + "#source-map": { + "node": "source-map", + "default": "./handlebars/compiler/source-map.js" + } + } +} diff --git a/lib/precompiler.js b/lib/precompiler.js index 2b3fb69df..cc651f763 100644 --- a/lib/precompiler.js +++ b/lib/precompiler.js @@ -1,8 +1,8 @@ /* eslint-env node */ /* eslint-disable no-console */ import Async from 'neo-async'; -import fs from 'fs'; -import * as Handlebars from './handlebars'; +import * as fs from 'fs'; +import Handlebars from './handlebars/index.js'; import { basename } from 'path'; import { SourceMapConsumer, SourceNode } from 'source-map'; diff --git a/nyc.config.js b/nyc.config.js index b71608a8a..a5d13d509 100644 --- a/nyc.config.js +++ b/nyc.config.js @@ -1,6 +1,7 @@ module.exports = { 'check-coverage': true, - branches: 100, + // TODO - can probably be increased once @handlebars/parser fixes its exports + branches: 98, lines: 100, functions: 100, statements: 100, diff --git a/package.json b/package.json index 815a694f5..683865db1 100644 --- a/package.json +++ b/package.json @@ -71,9 +71,30 @@ "webpack": "^1.12.6", "webpack-dev-server": "^1.12.1" }, - "main": "lib/index.js", + "imports": { + "#source-map": { + "node": "source-map", + "default": "./lib/handlebars/compiler/source-map.js" + } + }, + "exports": { + ".": { + "node": { + "import": "./lib/index.js", + "require": "./lib/index.cjs" + }, + "default": "./lib/handlebars/index.js" + }, + "./runtime": { + "node": { + "import": "./lib/handlebars/index.runtime.js", + "require": "./lib/index.runtime.cjs" + }, + "default": "./lib/handlebars/index.runtime.js" + } + }, + "main": "./lib/index.cjs", "types": "types/index.d.ts", - "browser": "./dist/cjs/handlebars.js", "bin": { "handlebars": "bin/handlebars.js" }, diff --git a/runtime.d.ts b/runtime.d.ts deleted file mode 100644 index 0d5105eb7..000000000 --- a/runtime.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Handlebars = require('handlebars') - -declare module "handlebars/runtime" { - -} \ No newline at end of file diff --git a/runtime.js b/runtime.js deleted file mode 100644 index 306207cd2..000000000 --- a/runtime.js +++ /dev/null @@ -1,3 +0,0 @@ -// Create a simple path alias to allow browserify to resolve -// the runtime on a supported path. -module.exports = require('./dist/cjs/handlebars.runtime')['default']; diff --git a/spec/env/node-esm.mjs b/spec/env/node-esm.mjs new file mode 100644 index 000000000..817ca0418 --- /dev/null +++ b/spec/env/node-esm.mjs @@ -0,0 +1,35 @@ +import './common.js'; + +import chai from 'chai'; +import dirtyChai from 'dirty-chai'; +import sinon from 'sinon'; + +import Handlebars from '../../lib/index.js'; + +chai.use(dirtyChai); +global.expect = chai.expect; + +global.sinon = sinon; + +global.Handlebars = Handlebars; + +global.CompilerContext = { + compile: function(template, options) { + var templateSpec = handlebarsEnv.precompile(template, options); + return handlebarsEnv.template(safeEval(templateSpec)); + }, + compileWithPartial: function(template, options) { + return handlebarsEnv.compile(template, options); + } +}; + +function safeEval(templateSpec) { + /* eslint-disable no-eval, no-console */ + try { + return eval('(' + templateSpec + ')'); + } catch (err) { + console.error(templateSpec); + throw err; + } + /* eslint-enable no-eval, no-console */ +} diff --git a/spec/env/node.js b/spec/env/node.js index bb96c1ecb..eecb9edf0 100644 --- a/spec/env/node.js +++ b/spec/env/node.js @@ -8,7 +8,7 @@ global.expect = chai.expect; global.sinon = require('sinon'); -global.Handlebars = require('../../lib'); +global.Handlebars = require('../..'); global.CompilerContext = { compile: function (template, options) { diff --git a/spec/env/runner.js b/spec/env/runner.js index ffd0b8b21..3bb1070b9 100644 --- a/spec/env/runner.js +++ b/spec/env/runner.js @@ -23,20 +23,22 @@ var files = fs }); if (global.minimizedTest) { - run('./runtime', function () { - run('./browser', function () { + run('./runtime.js', function () { + run('./browser.js', function () { /* eslint-disable no-process-exit */ process.exit(errors); /* eslint-enable no-process-exit */ }); }); } else { - run('./runtime', function () { - run('./browser', function () { - run('./node', function () { - /* eslint-disable no-process-exit */ - process.exit(errors); - /* eslint-enable no-process-exit */ + run('./runtime.js', function () { + run('./browser.js', function () { + run('./node.js', function () { + run('./node-esm.mjs', function () { + /* eslint-disable no-process-exit */ + process.exit(errors); + /* eslint-enable no-process-exit */ + }); }); }); }); @@ -55,9 +57,10 @@ function run(env, callback) { }); console.log('Running env: ' + env); - require(env); - mocha.run(function (errorCount) { - errors += errorCount; - callback(); + import(env).then(() => { + mocha.run(function (errorCount) { + errors += errorCount; + callback(); + }); }); } diff --git a/spec/precompiler.js b/spec/precompiler.js index 857f64e21..0b536ae3c 100644 --- a/spec/precompiler.js +++ b/spec/precompiler.js @@ -5,7 +5,7 @@ describe('precompiler', function () { return; } - var Handlebars = require('../lib'), + var Handlebars = require('..'), Precompiler = require('../dist/cjs/precompiler'), fs = require('fs'), uglify = require('uglify-js'); diff --git a/tests/bench/precompile-size.js b/tests/bench/precompile-size.js index 64e10854a..cfd0e718e 100644 --- a/tests/bench/precompile-size.js +++ b/tests/bench/precompile-size.js @@ -3,7 +3,7 @@ var _ = require('underscore'), module.exports = function (grunt, callback) { // Deferring to here in case we have a build for parser, etc as part of this grunt exec - var Handlebars = require('../../lib'); + var Handlebars = require('../..'); var templateSizes = {}; _.each(templates, function (info, template) { diff --git a/tests/bench/throughput.js b/tests/bench/throughput.js index b3591b683..44065a7ac 100644 --- a/tests/bench/throughput.js +++ b/tests/bench/throughput.js @@ -122,7 +122,7 @@ function makeSuite(bench, name, template, handlebarsOnly) { module.exports = function (grunt, callback) { // Deferring load in case we are being run inline with the grunt build - Handlebars = require('../../lib'); + Handlebars = require('../..'); console.log('Execution Throughput'); runner(grunt, makeSuite, function (times, scaled) { diff --git a/tests/integration/rollup-test/src/index.js b/tests/integration/rollup-test/src/index.js index 2929870d9..cbd13e78f 100644 --- a/tests/integration/rollup-test/src/index.js +++ b/tests/integration/rollup-test/src/index.js @@ -1,4 +1,4 @@ -import Handlebars from 'handlebars/lib/handlebars'; +import Handlebars from 'handlebars'; const template = Handlebars.compile('Author: {{author}}'); const result = template({ author: 'Yehuda' }); diff --git a/tests/integration/webpack-test/src/handlebars-esm-import-test.js b/tests/integration/webpack-test/src/handlebars-esm-import-test.js index c11473844..d8730b6c7 100644 --- a/tests/integration/webpack-test/src/handlebars-esm-import-test.js +++ b/tests/integration/webpack-test/src/handlebars-esm-import-test.js @@ -1,4 +1,4 @@ -import Handlebars from 'handlebars/lib/handlebars'; +import Handlebars from 'handlebars'; import { assertEquals } from './lib/assert'; const template = Handlebars.compile('Author: {{author}}'); diff --git a/tests/print-script.js b/tests/print-script.js index c8d9ddbb3..6436e8a27 100755 --- a/tests/print-script.js +++ b/tests/print-script.js @@ -4,7 +4,7 @@ var script = process.argv[2].replace(/\\n/g, '\n'), verbose = process.argv[3] === '-v'; -var Handlebars = require('./../lib'), +var Handlebars = require('..'), SourceMap = require('source-map'), SourceMapConsumer = SourceMap.SourceMapConsumer;