pax_global_header00006660000000000000000000000064136656345540014533gustar00rootroot0000000000000052 comment=57cd5973c313c420b1ad24a922d1c95ebec3c532 interpret-2.2.0/000077500000000000000000000000001366563455400135505ustar00rootroot00000000000000interpret-2.2.0/.editorconfig000066400000000000000000000003261366563455400162260ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true end_of_line = lf [*.md] trim_trailing_whitespace = false interpret-2.2.0/.eslintignore000066400000000000000000000000301366563455400162440ustar00rootroot00000000000000test/fixtures coverage/ interpret-2.2.0/.eslintrc000066400000000000000000000001541366563455400153740ustar00rootroot00000000000000{ "extends": "gulp", "rules": { "max-len": ["error", { "code": 110, "ignoreComments": true }] } } interpret-2.2.0/.gitattributes000066400000000000000000000000161366563455400164400ustar00rootroot00000000000000* text eol=lf interpret-2.2.0/.github/000077500000000000000000000000001366563455400151105ustar00rootroot00000000000000interpret-2.2.0/.github/FUNDING.yml000066400000000000000000000001011366563455400167150ustar00rootroot00000000000000github: [phated] tidelift: npm/interpret open_collective: gulpjs interpret-2.2.0/.github/security.md000066400000000000000000000002631366563455400173020ustar00rootroot00000000000000# Security Policy To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. interpret-2.2.0/.gitignore000066400000000000000000000012741366563455400155440ustar00rootroot00000000000000# Logs logs *.log # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage .nyc_output # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory # Commenting this out is preferred by some people, see # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- node_modules # Users Environment Variables .lock-wscript # Garbage files .DS_Store tmp egcache # Created in fixtures directories by test package-lock.json interpret-2.2.0/.npmrc000066400000000000000000000000231366563455400146630ustar00rootroot00000000000000package-lock=false interpret-2.2.0/.travis.yml000066400000000000000000000002241366563455400156570ustar00rootroot00000000000000sudo: false language: node_js node_js: - '14' - '12' - '10' - '8' - '6' - '4' - '0.12' - '0.10' after_script: - npm run coveralls interpret-2.2.0/CHANGELOG000066400000000000000000000044741366563455400147730ustar00rootroot00000000000000v1.0.3: date: 2017-04-18 changes: - fix buble support v1.0.2: date: 2017-03-29 changes: - add support for coffeescript (now with no hyphen) v1.0.1: date: 2016-05-01 changes: - add support for buble v1.0.0: date: 2015-11-18 changes: - add support for babel-register - go stable! v0.6.6: date: 2015-09-21 changes: - add support for ts-node (formerly typescript-node) v0.6.5: date: 2015-07-22 changes: - add support for typescript 1.5 via typescript-node v0.6.4: date: 2015-07-07 changes: - add support for earlgrey v0.6.3: date: 2015-07-03 changes: - prefer babel/core to babel v0.6.2: date: 2015-05-20 changes: - update module list for iced coffee-script v0.6.1: date: 2015-05-20 changes: - Fix toml loader. v0.6.0: date: 2015-05-19 changes: - Combine fallbacks and loaders into `extensions`. - Provide implementation guidance. v0.5.1: date: 2015-03-01 changes: - Add support for CirruScript. v0.5.0: date: 2015-02-27 changes: - Refactor es6 support via Babel (formerly 6to5) v0.4.3: date: 2015-02-09 changes: - Switch support from typescript-require to typescript-register. v0.4.2: date: 2015-01-16 changes: - Add support for wisp. v0.4.1: date: 2015-01-10 changes: - Add support for 6to5 (es6) v0.4.0: date: 2014-01-09 changes: - Add support for fallback (legacy) modules - Add support for module configurations v0.3.10: date: 2014-12-17 changes: - Add support for json5. v0.3.9: date: 2014-12-08 changes: - Add support for literate iced coffee. v0.3.8: date: 2014-11-20 changes: - Add support for [cjsx](https://github.com/jsdf/coffee-react). v0.3.7: date: 2014-09-08 changes: - Add support for [TypeScript](http://www.typescriptlang.org/). v0.3.6: date: 2014-08-25 changes: - Add support for coffee.md. v0.3.5: date: 2014-07-03 changes: - Add support for jsx. v0.3.4: date: 2014-06-27 changes: - Make .js first jsVariant entry. v0.3.3: date: 2014-06-02 changes: - Fix casing on livescript dependency. v0.3.0: date: 2014-04-20 changes: - Simplify loading of coffee-script and iced-coffee-script. v0.2.0: date: 2014-04-20 changes: - Move module loading into rechoir. v0.1.0: date: 2014-04-20 changes: - Initial public release. interpret-2.2.0/LICENSE000066400000000000000000000022131366563455400145530ustar00rootroot00000000000000Copyright (c) 2014-2018 Tyler Kellen , Blaine Bublitz , and Eric Schoffstall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. interpret-2.2.0/README.md000066400000000000000000000157161366563455400150410ustar00rootroot00000000000000

# interpret [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] A dictionary of file extensions and associated module loaders. ## What is it This is used by [Liftoff](http://github.com/tkellen/node-liftoff) to automatically require dependencies for configuration files, and by [rechoir](http://github.com/tkellen/node-rechoir) for registering module loaders. ## interpret for enterprise Available as part of the Tidelift Subscription The maintainers of interpret and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-interpret?utm_source=npm-interpret&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) ## API ### extensions Map file types to modules which provide a [require.extensions] loader. ```js { '.babel.js': [ { module: '@babel/register', register: function(hook) { hook({ extensions: '.js', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, { module: 'babel-register', register: function(hook) { hook({ extensions: '.js', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel-core/register', register: function(hook) { hook({ extensions: '.js', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel/register', register: function(hook) { hook({ extensions: '.js', ignore: ignoreNonBabelAndNodeModules, }); }, }, ], '.babel.ts': [ { module: '@babel/register', register: function(hook) { hook({ extensions: '.ts', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, ], '.buble.js': 'buble/register', '.cirru': 'cirru-script/lib/register', '.cjsx': 'node-cjsx/register', '.co': 'coco', '.coffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], '.coffee.md': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], '.csv': 'require-csv', '.eg': 'earlgrey/register', '.esm.js': { module: 'esm', register: function(hook) { // register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353 // which only captures the final extension (.babel.js -> .js) var esmLoader = hook(module); require.extensions['.js'] = esmLoader('module')._extensions['.js']; }, }, '.iced': ['iced-coffee-script/register', 'iced-coffee-script'], '.iced.md': 'iced-coffee-script/register', '.ini': 'require-ini', '.js': null, '.json': null, '.json5': ['json5/lib/register', 'json5/lib/require'], '.jsx': [ { module: '@babel/register', register: function(hook) { hook({ extensions: '.jsx', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, { module: 'babel-register', register: function(hook) { hook({ extensions: '.jsx', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel-core/register', register: function(hook) { hook({ extensions: '.jsx', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel/register', register: function(hook) { hook({ extensions: '.jsx', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'node-jsx', register: function(hook) { hook.install({ extension: '.jsx', harmony: true }); }, }, ], '.litcoffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], '.liticed': 'iced-coffee-script/register', '.ls': ['livescript', 'LiveScript'], '.mjs': '/absolute/path/to/interpret/mjs-stub.js', '.node': null, '.toml': { module: 'toml-require', register: function(hook) { hook.install(); }, }, '.ts': [ 'ts-node/register', 'typescript-node/register', 'typescript-register', 'typescript-require', 'sucrase/register/ts', { module: '@babel/register', register: function(hook) { hook({ extensions: '.ts', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, ], '.tsx': [ 'ts-node/register', 'typescript-node/register', 'sucrase/register', { module: '@babel/register', register: function(hook) { hook({ extensions: '.tsx', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, ], '.wisp': 'wisp/engine/node', '.xml': 'require-xml', '.yaml': 'require-yaml', '.yml': 'require-yaml', } ``` ### jsVariants Same as above, but only include the extensions which are javascript variants. ## How to use it Consumers should use the exported `extensions` or `jsVariants` object to determine which module should be loaded for a given extension. If a matching extension is found, consumers should do the following: 1. If the value is null, do nothing. 2. If the value is a string, try to require it. 3. If the value is an object, try to require the `module` property. If successful, the `register` property (a function) should be called with the module passed as the first argument. 4. If the value is an array, iterate over it, attempting step #2 or #3 until one of the attempts does not throw. [require.extensions]: http://nodejs.org/api/globals.html#globals_require_extensions [downloads-image]: http://img.shields.io/npm/dm/interpret.svg [npm-url]: https://www.npmjs.com/package/interpret [npm-image]: http://img.shields.io/npm/v/interpret.svg [travis-url]: https://travis-ci.org/gulpjs/interpret [travis-image]: http://img.shields.io/travis/gulpjs/interpret.svg?label=travis-ci [appveyor-url]: https://ci.appveyor.com/project/gulpjs/interpret [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/interpret.svg?label=appveyor [coveralls-url]: https://coveralls.io/r/gulpjs/interpret [coveralls-image]: http://img.shields.io/coveralls/gulpjs/interpret/master.svg [gitter-url]: https://gitter.im/gulpjs/gulp [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg interpret-2.2.0/appveyor.yml000066400000000000000000000010421366563455400161350ustar00rootroot00000000000000# http://www.appveyor.com/docs/appveyor-yml # http://www.appveyor.com/docs/lang/nodejs-iojs environment: matrix: # node.js - nodejs_version: "0.10" - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "6" - nodejs_version: "8" - nodejs_version: "10" - nodejs_version: "12" - nodejs_version: "14" install: - ps: Install-Product node $env:nodejs_version - npm install test_script: - node --version - npm --version - cmd: npm test build: off # build version format version: "{build}" interpret-2.2.0/index.js000066400000000000000000000115331366563455400152200ustar00rootroot00000000000000var path = require('path'); var endsInBabelJs = /\.babel\.[jt]s(x)$/; var mjsStub = path.join(__dirname, 'mjs-stub'); function ignoreNonBabelAndNodeModules(file) { return !endsInBabelJs.test(file) && path.relative(process.cwd(), file).split(path.sep).indexOf('node_modules') >= 0; } var extensions = { '.babel.js': [ { module: '@babel/register', register: function(hook) { hook({ extensions: '.js', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, { module: 'babel-register', register: function(hook) { hook({ extensions: '.js', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel-core/register', register: function(hook) { hook({ extensions: '.js', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel/register', register: function(hook) { hook({ extensions: '.js', ignore: ignoreNonBabelAndNodeModules, }); }, }, ], '.babel.ts': [ { module: '@babel/register', register: function(hook) { hook({ extensions: '.ts', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, ], '.buble.js': 'buble/register', '.cirru': 'cirru-script/lib/register', '.cjsx': 'node-cjsx/register', '.co': 'coco', '.coffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], '.coffee.md': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], '.csv': 'require-csv', '.eg': 'earlgrey/register', '.esm.js': { module: 'esm', register: function(hook) { // register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353 // which only captures the final extension (.babel.js -> .js) var esmLoader = hook(module); require.extensions['.js'] = esmLoader('module')._extensions['.js']; }, }, '.iced': ['iced-coffee-script/register', 'iced-coffee-script'], '.iced.md': 'iced-coffee-script/register', '.ini': 'require-ini', '.js': null, '.json': null, '.json5': ['json5/lib/register', 'json5/lib/require'], '.jsx': [ { module: '@babel/register', register: function(hook) { hook({ extensions: '.jsx', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, { module: 'babel-register', register: function(hook) { hook({ extensions: '.jsx', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel-core/register', register: function(hook) { hook({ extensions: '.jsx', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'babel/register', register: function(hook) { hook({ extensions: '.jsx', ignore: ignoreNonBabelAndNodeModules, }); }, }, { module: 'node-jsx', register: function(hook) { hook.install({ extension: '.jsx', harmony: true }); }, }, ], '.litcoffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], '.liticed': 'iced-coffee-script/register', '.ls': ['livescript', 'LiveScript'], '.mjs': mjsStub, '.node': null, '.toml': { module: 'toml-require', register: function(hook) { hook.install(); }, }, '.ts': [ 'ts-node/register', 'typescript-node/register', 'typescript-register', 'typescript-require', 'sucrase/register/ts', { module: '@babel/register', register: function(hook) { hook({ extensions: '.ts', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, ], '.tsx': [ 'ts-node/register', 'typescript-node/register', 'sucrase/register', { module: '@babel/register', register: function(hook) { hook({ extensions: '.tsx', rootMode: 'upward-optional', ignore: [ignoreNonBabelAndNodeModules], }); }, }, ], '.wisp': 'wisp/engine/node', '.xml': 'require-xml', '.yaml': 'require-yaml', '.yml': 'require-yaml', }; var jsVariantExtensions = [ '.js', '.babel.js', '.babel.ts', '.buble.js', '.cirru', '.cjsx', '.co', '.coffee', '.coffee.md', '.eg', '.esm.js', '.iced', '.iced.md', '.jsx', '.litcoffee', '.liticed', '.ls', '.mjs', '.ts', '.tsx', '.wisp', ]; module.exports = { extensions: extensions, jsVariants: jsVariantExtensions.reduce(function(result, ext) { result[ext] = extensions[ext]; return result; }, {}), }; interpret-2.2.0/mjs-stub.js000066400000000000000000000000431366563455400156470ustar00rootroot00000000000000require.extensions['.mjs'] = null; interpret-2.2.0/package.json000066400000000000000000000030651366563455400160420ustar00rootroot00000000000000{ "name": "interpret", "version": "2.2.0", "description": "A dictionary of file extensions and associated module loaders.", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ "Blaine Bublitz ", "Tyler Kellen (http://goingslowly.com/)" ], "repository": "gulpjs/interpret", "license": "MIT", "engines": { "node": ">= 0.10" }, "main": "index.js", "files": [ "LICENSE", "index.js", "mjs-stub.js" ], "scripts": { "lint": "eslint .", "pretest": "rm -rf tmp/ && npm run lint", "test": "mocha --async-only", "cover": "nyc --reporter=lcov --reporter=text-summary npm test", "coveralls": "nyc --reporter=text-lcov npm test | coveralls" }, "dependencies": {}, "devDependencies": { "coveralls": "github:phated/node-coveralls#2.x", "eslint": "^2.13.0", "eslint-config-gulp": "^3.0.1", "expect": "^1.20.2", "mocha": "^3.5.3", "nyc": "^10.3.2", "parse-node-version": "^1.0.0", "rechoir": "^0.7.0", "shelljs": "0.7.5", "trash-cli": "^3.0.0" }, "keywords": [ "cirru-script", "cjsx", "co", "coco", "coffee", "coffee-script", "coffee.md", "coffeescript", "csv", "earlgrey", "es", "es6", "iced", "iced.md", "iced-coffee-script", "ini", "js", "json", "json5", "jsx", "react", "litcoffee", "liticed", "ls", "livescript", "toml", "ts", "typescript", "wisp", "xml", "yaml", "yml" ] } interpret-2.2.0/test/000077500000000000000000000000001366563455400145275ustar00rootroot00000000000000interpret-2.2.0/test/.eslintrc000066400000000000000000000001031366563455400163450ustar00rootroot00000000000000{ "extends": "gulp/test", "rules": { "no-console": 0 } } interpret-2.2.0/test/fixtures/000077500000000000000000000000001366563455400164005ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.js/000077500000000000000000000000001366563455400200605ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.js/0/000077500000000000000000000000001366563455400202175ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.js/0/.babelrc000066400000000000000000000000521366563455400216070ustar00rootroot00000000000000{ "presets": ["@babel/preset-react"], } interpret-2.2.0/test/fixtures/babel.js/0/package.json000066400000000000000000000001761366563455400225110ustar00rootroot00000000000000{ "dependencies": { "@babel/core": "^7.2.2", "@babel/preset-react": "^7.0.0", "@babel/register": "^7.0.0" } } interpret-2.2.0/test/fixtures/babel.js/0/test.babel.js000066400000000000000000000003551366563455400226030ustar00rootroot00000000000000// Test ES6 arrow functions var fn = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; module.exports = fn(); interpret-2.2.0/test/fixtures/babel.js/1/000077500000000000000000000000001366563455400202205ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.js/1/.babelrc000066400000000000000000000000341366563455400216100ustar00rootroot00000000000000{ "presets": ["es2015"] } interpret-2.2.0/test/fixtures/babel.js/1/package.json000066400000000000000000000001421366563455400225030ustar00rootroot00000000000000{ "dependencies": { "babel-preset-es2015": "^6.24.1", "babel-register": "^6.26.0" } } interpret-2.2.0/test/fixtures/babel.js/1/test.babel.js000066400000000000000000000003551366563455400226040ustar00rootroot00000000000000// Test ES6 arrow functions var fn = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; module.exports = fn(); interpret-2.2.0/test/fixtures/babel.js/2/000077500000000000000000000000001366563455400202215ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.js/2/.babelrc000066400000000000000000000000341366563455400216110ustar00rootroot00000000000000{ "presets": ["es2015"] } interpret-2.2.0/test/fixtures/babel.js/2/package.json000066400000000000000000000001361366563455400225070ustar00rootroot00000000000000{ "dependencies": { "babel-core": "^6.26.3", "babel-preset-es2015": "^6.24.1" } } interpret-2.2.0/test/fixtures/babel.js/2/test.babel.js000066400000000000000000000003551366563455400226050ustar00rootroot00000000000000// Test ES6 arrow functions var fn = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; module.exports = fn(); interpret-2.2.0/test/fixtures/babel.js/3/000077500000000000000000000000001366563455400202225ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.js/3/package.json000066400000000000000000000000631366563455400225070ustar00rootroot00000000000000{ "dependencies": { "babel": "^5.8.38" } } interpret-2.2.0/test/fixtures/babel.js/3/test.babel.js000066400000000000000000000003551366563455400226060ustar00rootroot00000000000000// Test ES6 arrow functions var fn = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; module.exports = fn(); interpret-2.2.0/test/fixtures/babel.ts/000077500000000000000000000000001366563455400200725ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.ts/0/000077500000000000000000000000001366563455400202315ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/babel.ts/0/.babelrc000066400000000000000000000000561366563455400216250ustar00rootroot00000000000000{ "presets": ["@babel/preset-typescript"] } interpret-2.2.0/test/fixtures/babel.ts/0/package.json000066400000000000000000000002031366563455400225120ustar00rootroot00000000000000{ "dependencies": { "@babel/core": "^7.2.2", "@babel/preset-typescript": "^7.1.0", "@babel/register": "^7.0.0" } } interpret-2.2.0/test/fixtures/babel.ts/0/test.babel.ts000066400000000000000000000003551366563455400226270ustar00rootroot00000000000000// Test ES6 arrow functions var fn = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; module.exports = fn(); interpret-2.2.0/test/fixtures/buble.js/000077500000000000000000000000001366563455400201045ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/buble.js/0/000077500000000000000000000000001366563455400202435ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/buble.js/0/package.json000066400000000000000000000000631366563455400225300ustar00rootroot00000000000000{ "dependencies": { "buble": "^0.19.6" } } interpret-2.2.0/test/fixtures/buble.js/0/test.buble.js000066400000000000000000000003551366563455400226530ustar00rootroot00000000000000// Test ES6 arrow functions var fn = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; module.exports = fn(); interpret-2.2.0/test/fixtures/cirru/000077500000000000000000000000001366563455400175245ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/cirru/0/000077500000000000000000000000001366563455400176635ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/cirru/0/package.json000066400000000000000000000001371366563455400221520ustar00rootroot00000000000000{ "dependencies": { "babel-preset-es2015": "^6.24.1", "cirru-script": "^0.5.5" } } interpret-2.2.0/test/fixtures/cirru/0/test.cirru000066400000000000000000000001671366563455400217140ustar00rootroot00000000000000= module.exports $ object :data $ object :falseKey false :subKey $ object :subProp 1 :trueKey true interpret-2.2.0/test/fixtures/cjsx/000077500000000000000000000000001366563455400173475ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/cjsx/0/000077500000000000000000000000001366563455400175065ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/cjsx/0/package.json000066400000000000000000000000661366563455400217760ustar00rootroot00000000000000{ "dependencies": { "node-cjsx": "^2.0.0" } } interpret-2.2.0/test/fixtures/cjsx/0/test.cjsx000066400000000000000000000004571366563455400213640ustar00rootroot00000000000000React = createElement: (Component) -> Component() # Test harmony arrow functions Component = -> trueKey = true falseKey = false subKey = subProp: 1 # Test harmony object short notation { data: trueKey: trueKey falseKey: falseKey subKey: subKey } module.exports = interpret-2.2.0/test/fixtures/co/000077500000000000000000000000001366563455400170015ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/co/0/000077500000000000000000000000001366563455400171405ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/co/0/package.json000066400000000000000000000000611366563455400214230ustar00rootroot00000000000000{ "dependencies": { "coco": "^0.9.1" } } interpret-2.2.0/test/fixtures/co/0/test.co000066400000000000000000000001561366563455400204440ustar00rootroot00000000000000module.exports = { data: { trueKey: true falseKey: false subKey: { subProp: 1 } } } interpret-2.2.0/test/fixtures/coffee.md/000077500000000000000000000000001366563455400202265ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee.md/0/000077500000000000000000000000001366563455400203655ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee.md/0/package.json000066400000000000000000000000711366563455400226510ustar00rootroot00000000000000{ "dependencies": { "coffeescript": "^2.3.2" } } interpret-2.2.0/test/fixtures/coffee.md/0/test.coffee.md000066400000000000000000000002201366563455400231060ustar00rootroot00000000000000Test Fixture ============ module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/coffee.md/1/000077500000000000000000000000001366563455400203665ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee.md/1/package.json000066400000000000000000000000731366563455400226540ustar00rootroot00000000000000{ "dependencies": { "coffee-script": "^1.12.7" } } interpret-2.2.0/test/fixtures/coffee.md/1/test.coffee.md000066400000000000000000000002201366563455400231070ustar00rootroot00000000000000Test Fixture ============ module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/coffee.md/2/000077500000000000000000000000001366563455400203675ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee.md/2/package.json000066400000000000000000000000711366563455400226530ustar00rootroot00000000000000{ "dependencies": { "coffeescript": "^2.3.2" } } interpret-2.2.0/test/fixtures/coffee.md/2/test.coffee.md000066400000000000000000000002201366563455400231100ustar00rootroot00000000000000Test Fixture ============ module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/coffee.md/3/000077500000000000000000000000001366563455400203705ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee.md/3/package.json000066400000000000000000000000731366563455400226560ustar00rootroot00000000000000{ "dependencies": { "coffee-script": "^1.12.7" } } interpret-2.2.0/test/fixtures/coffee.md/3/test.coffee.md000066400000000000000000000002201366563455400231110ustar00rootroot00000000000000Test Fixture ============ module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/coffee/000077500000000000000000000000001366563455400176275ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee/0/000077500000000000000000000000001366563455400177665ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee/0/package.json000066400000000000000000000000711366563455400222520ustar00rootroot00000000000000{ "dependencies": { "coffeescript": "^2.3.2" } } interpret-2.2.0/test/fixtures/coffee/0/test.coffee000066400000000000000000000001341366563455400221140ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/coffee/1/000077500000000000000000000000001366563455400177675ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee/1/package.json000066400000000000000000000000731366563455400222550ustar00rootroot00000000000000{ "dependencies": { "coffee-script": "^1.12.7" } } interpret-2.2.0/test/fixtures/coffee/1/test.coffee000066400000000000000000000001341366563455400221150ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/coffee/2/000077500000000000000000000000001366563455400177705ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee/2/package.json000066400000000000000000000000711366563455400222540ustar00rootroot00000000000000{ "dependencies": { "coffeescript": "^2.3.2" } } interpret-2.2.0/test/fixtures/coffee/2/test.coffee000066400000000000000000000001341366563455400221160ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/coffee/3/000077500000000000000000000000001366563455400177715ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/coffee/3/package.json000066400000000000000000000000731366563455400222570ustar00rootroot00000000000000{ "dependencies": { "coffee-script": "^1.12.7" } } interpret-2.2.0/test/fixtures/coffee/3/test.coffee000066400000000000000000000001341366563455400221170ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/csv/000077500000000000000000000000001366563455400171735ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/csv/0/000077500000000000000000000000001366563455400173325ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/csv/0/package.json000066400000000000000000000000671366563455400216230ustar00rootroot00000000000000{ "dependencies": { "require-csv": "0.0.1" } } interpret-2.2.0/test/fixtures/csv/0/test.csv000066400000000000000000000000341366563455400210230ustar00rootroot00000000000000"r1c1","r1c2" "r2c1","r2c2" interpret-2.2.0/test/fixtures/eg/000077500000000000000000000000001366563455400167735ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/eg/0/000077500000000000000000000000001366563455400171325ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/eg/0/package.json000066400000000000000000000000651366563455400214210ustar00rootroot00000000000000{ "dependencies": { "earlgrey": "^0.1.2" } } interpret-2.2.0/test/fixtures/eg/0/test.eg000066400000000000000000000002001366563455400204160ustar00rootroot00000000000000module.exports = { data = { trueKey = true falseKey = false subKey = { subProp = 1 } } } interpret-2.2.0/test/fixtures/esm.js/000077500000000000000000000000001366563455400175775ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/esm.js/0/000077500000000000000000000000001366563455400177365ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/esm.js/0/package.json000066400000000000000000000000611366563455400222210ustar00rootroot00000000000000{ "dependencies": { "esm": "^3.0.84" } } interpret-2.2.0/test/fixtures/esm.js/0/test.esm.js000066400000000000000000000002011366563455400220270ustar00rootroot00000000000000var test = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; export default test; interpret-2.2.0/test/fixtures/iced.md/000077500000000000000000000000001366563455400177035ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/iced.md/0/000077500000000000000000000000001366563455400200425ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/iced.md/0/package.json000066400000000000000000000001021366563455400223210ustar00rootroot00000000000000{ "dependencies": { "iced-coffee-script": "^108.0.11" } } interpret-2.2.0/test/fixtures/iced.md/0/test.iced.md000066400000000000000000000002171366563455400222460ustar00rootroot00000000000000Test Fixture ============ module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/iced/000077500000000000000000000000001366563455400173045ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/iced/0/000077500000000000000000000000001366563455400174435ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/iced/0/package.json000066400000000000000000000001021366563455400217220ustar00rootroot00000000000000{ "dependencies": { "iced-coffee-script": "^108.0.11" } } interpret-2.2.0/test/fixtures/iced/0/test.iced000066400000000000000000000001341366563455400212460ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/iced/1/000077500000000000000000000000001366563455400174445ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/iced/1/package.json000066400000000000000000000001021366563455400217230ustar00rootroot00000000000000{ "dependencies": { "iced-coffee-script": "^108.0.11" } } interpret-2.2.0/test/fixtures/iced/1/test.iced000066400000000000000000000001341366563455400212470ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/ini/000077500000000000000000000000001366563455400171575ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ini/0/000077500000000000000000000000001366563455400173165ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ini/0/package.json000066400000000000000000000000671366563455400216070ustar00rootroot00000000000000{ "dependencies": { "require-ini": "0.0.1" } } interpret-2.2.0/test/fixtures/ini/0/test.ini000066400000000000000000000001011366563455400207660ustar00rootroot00000000000000[data] falseKey = false subKey[subProp] = 1 trueKey = true interpret-2.2.0/test/fixtures/js/000077500000000000000000000000001366563455400170145ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/js/0/000077500000000000000000000000001366563455400171535ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/js/0/package.json000066400000000000000000000000031366563455400214320ustar00rootroot00000000000000{} interpret-2.2.0/test/fixtures/js/0/test.js000066400000000000000000000001611366563455400204660ustar00rootroot00000000000000module.exports = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; interpret-2.2.0/test/fixtures/json/000077500000000000000000000000001366563455400173515ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/json/0/000077500000000000000000000000001366563455400175105ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/json/0/package.json000066400000000000000000000000031366563455400217670ustar00rootroot00000000000000{} interpret-2.2.0/test/fixtures/json/0/test.json000066400000000000000000000001511366563455400213570ustar00rootroot00000000000000{ "data": { "trueKey": true, "falseKey": false, "subKey": { "subProp": 1 } } } interpret-2.2.0/test/fixtures/json5/000077500000000000000000000000001366563455400174365ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/json5/0/000077500000000000000000000000001366563455400175755ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/json5/0/package.json000066400000000000000000000000621366563455400220610ustar00rootroot00000000000000{ "dependencies": { "json5": "^2.1.0" } } interpret-2.2.0/test/fixtures/json5/0/test.json5000066400000000000000000000002121366563455400215270ustar00rootroot00000000000000{ "data": { "trueKey": true, "falseKey": false, "subKey": { "subProp": 1 } } /* omg, a comment in json?? */ } interpret-2.2.0/test/fixtures/json5/1/000077500000000000000000000000001366563455400175765ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/json5/1/package.json000066400000000000000000000000621366563455400220620ustar00rootroot00000000000000{ "dependencies": { "json5": "^0.5.0" } } interpret-2.2.0/test/fixtures/json5/1/test.json5000066400000000000000000000002121366563455400215300ustar00rootroot00000000000000{ "data": { "trueKey": true, "falseKey": false, "subKey": { "subProp": 1 } } /* omg, a comment in json?? */ } interpret-2.2.0/test/fixtures/jsx/000077500000000000000000000000001366563455400172045ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/jsx/0/000077500000000000000000000000001366563455400173435ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/jsx/0/.babelrc000066400000000000000000000000511366563455400207320ustar00rootroot00000000000000{ "presets": ["@babel/preset-react"] } interpret-2.2.0/test/fixtures/jsx/0/package.json000066400000000000000000000001761366563455400216350ustar00rootroot00000000000000{ "dependencies": { "@babel/core": "^7.2.2", "@babel/preset-react": "^7.0.0", "@babel/register": "^7.0.0" } } interpret-2.2.0/test/fixtures/jsx/0/test.jsx000066400000000000000000000005541366563455400210540ustar00rootroot00000000000000const React = { createElement: function(Component){ return Component(); } }; // Test harmony arrow functions const Component = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; // Test JSX syntax module.exports = ; interpret-2.2.0/test/fixtures/jsx/1/000077500000000000000000000000001366563455400173445ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/jsx/1/.babelrc000066400000000000000000000000451366563455400207360ustar00rootroot00000000000000{ "presets": ["es2015", "react"] } interpret-2.2.0/test/fixtures/jsx/1/package.json000066400000000000000000000002071366563455400216310ustar00rootroot00000000000000{ "dependencies": { "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "babel-register": "^6.26.0" } } interpret-2.2.0/test/fixtures/jsx/1/test.jsx000066400000000000000000000005541366563455400210550ustar00rootroot00000000000000const React = { createElement: function(Component){ return Component(); } }; // Test harmony arrow functions const Component = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; // Test JSX syntax module.exports = ; interpret-2.2.0/test/fixtures/jsx/2/000077500000000000000000000000001366563455400173455ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/jsx/2/.babelrc000066400000000000000000000000451366563455400207370ustar00rootroot00000000000000{ "presets": ["es2015", "react"] } interpret-2.2.0/test/fixtures/jsx/2/package.json000066400000000000000000000002031366563455400216260ustar00rootroot00000000000000{ "dependencies": { "babel-core": "^6.26.3", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1" } } interpret-2.2.0/test/fixtures/jsx/2/test.jsx000066400000000000000000000005541366563455400210560ustar00rootroot00000000000000const React = { createElement: function(Component){ return Component(); } }; // Test harmony arrow functions const Component = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; // Test JSX syntax module.exports = ; interpret-2.2.0/test/fixtures/jsx/3/000077500000000000000000000000001366563455400173465ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/jsx/3/package.json000066400000000000000000000000631366563455400216330ustar00rootroot00000000000000{ "dependencies": { "babel": "^5.8.38" } } interpret-2.2.0/test/fixtures/jsx/3/test.jsx000066400000000000000000000005541366563455400210570ustar00rootroot00000000000000const React = { createElement: function(Component){ return Component(); } }; // Test harmony arrow functions const Component = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; // Test JSX syntax module.exports = ; interpret-2.2.0/test/fixtures/jsx/4/000077500000000000000000000000001366563455400173475ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/jsx/4/package.json000066400000000000000000000000661366563455400216370ustar00rootroot00000000000000{ "dependencies": { "node-jsx": "^0.13.3" } } interpret-2.2.0/test/fixtures/jsx/4/test.jsx000066400000000000000000000005541366563455400210600ustar00rootroot00000000000000const React = { createElement: function(Component){ return Component(); } }; // Test harmony arrow functions const Component = () => { var trueKey = true; var falseKey = false; var subKey = { subProp: 1 }; // Test harmony object short notation return { data: { trueKey, falseKey, subKey}}; }; // Test JSX syntax module.exports = ; interpret-2.2.0/test/fixtures/litcoffee/000077500000000000000000000000001366563455400203405ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/litcoffee/0/000077500000000000000000000000001366563455400204775ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/litcoffee/0/package.json000066400000000000000000000000711366563455400227630ustar00rootroot00000000000000{ "dependencies": { "coffeescript": "^2.3.2" } } interpret-2.2.0/test/fixtures/litcoffee/0/test.litcoffee000066400000000000000000000001771366563455400233450ustar00rootroot00000000000000# comment module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/litcoffee/1/000077500000000000000000000000001366563455400205005ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/litcoffee/1/package.json000066400000000000000000000000731366563455400227660ustar00rootroot00000000000000{ "dependencies": { "coffee-script": "^1.12.7" } } interpret-2.2.0/test/fixtures/litcoffee/1/test.litcoffee000066400000000000000000000001771366563455400233460ustar00rootroot00000000000000# comment module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/litcoffee/2/000077500000000000000000000000001366563455400205015ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/litcoffee/2/package.json000066400000000000000000000000711366563455400227650ustar00rootroot00000000000000{ "dependencies": { "coffeescript": "^2.3.2" } } interpret-2.2.0/test/fixtures/litcoffee/2/test.litcoffee000066400000000000000000000001771366563455400233470ustar00rootroot00000000000000# comment module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/litcoffee/3/000077500000000000000000000000001366563455400205025ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/litcoffee/3/package.json000066400000000000000000000000731366563455400227700ustar00rootroot00000000000000{ "dependencies": { "coffee-script": "^1.12.7" } } interpret-2.2.0/test/fixtures/litcoffee/3/test.litcoffee000066400000000000000000000001771366563455400233500ustar00rootroot00000000000000# comment module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/liticed/000077500000000000000000000000001366563455400200155ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/liticed/0/000077500000000000000000000000001366563455400201545ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/liticed/0/package.json000066400000000000000000000001021366563455400224330ustar00rootroot00000000000000{ "dependencies": { "iced-coffee-script": "^108.0.11" } } interpret-2.2.0/test/fixtures/liticed/0/test.liticed000066400000000000000000000001771366563455400224770ustar00rootroot00000000000000# comment module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/ls/000077500000000000000000000000001366563455400170165ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ls/0/000077500000000000000000000000001366563455400171555ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ls/0/package.json000066400000000000000000000000671366563455400214460ustar00rootroot00000000000000{ "dependencies": { "livescript": "^1.6.0" } } interpret-2.2.0/test/fixtures/ls/0/test.ls000066400000000000000000000001341366563455400204720ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/ls/1/000077500000000000000000000000001366563455400171565ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ls/1/package.json000066400000000000000000000000671366563455400214470ustar00rootroot00000000000000{ "dependencies": { "LiveScript": "^1.3.1" } } interpret-2.2.0/test/fixtures/ls/1/test.ls000066400000000000000000000001341366563455400204730ustar00rootroot00000000000000module.exports = data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/mjs/000077500000000000000000000000001366563455400171715ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/mjs/0/000077500000000000000000000000001366563455400173305ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/mjs/0/package.json000066400000000000000000000000031366563455400216070ustar00rootroot00000000000000{} interpret-2.2.0/test/fixtures/mjs/0/test.mjs000066400000000000000000000001571366563455400210250ustar00rootroot00000000000000export default { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; interpret-2.2.0/test/fixtures/mjs/1/000077500000000000000000000000001366563455400173315ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/mjs/1/package.json000066400000000000000000000000031366563455400216100ustar00rootroot00000000000000{} interpret-2.2.0/test/fixtures/mjs/1/test.mjs000066400000000000000000000001611366563455400210210ustar00rootroot00000000000000module.exports = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; interpret-2.2.0/test/fixtures/toml/000077500000000000000000000000001366563455400173535ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/toml/0/000077500000000000000000000000001366563455400175125ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/toml/0/package.json000066400000000000000000000000711366563455400217760ustar00rootroot00000000000000{ "dependencies": { "toml-require": "^1.2.0" } } interpret-2.2.0/test/fixtures/toml/0/test.toml000066400000000000000000000001061366563455400213630ustar00rootroot00000000000000[data] trueKey = true falseKey = false [data.subKey] subProp = 1 interpret-2.2.0/test/fixtures/ts/000077500000000000000000000000001366563455400170265ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ts/0/000077500000000000000000000000001366563455400171655ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ts/0/package.json000066400000000000000000000001201366563455400214440ustar00rootroot00000000000000{ "dependencies": { "ts-node": "^7.0.1", "typescript": "^3.2.2" } } interpret-2.2.0/test/fixtures/ts/0/test.ts000066400000000000000000000002011366563455400205050ustar00rootroot00000000000000var test = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; export default test; interpret-2.2.0/test/fixtures/ts/0/tsconfig.json000066400000000000000000000003141366563455400216720ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp" } } interpret-2.2.0/test/fixtures/ts/1/000077500000000000000000000000001366563455400171665ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ts/1/package.json000066400000000000000000000001271366563455400214540ustar00rootroot00000000000000{ "dependencies": { "typescript": "1.5.3", "typescript-node": "^0.1.3" } } interpret-2.2.0/test/fixtures/ts/1/test.ts000066400000000000000000000002011366563455400205060ustar00rootroot00000000000000var test = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; export default test; interpret-2.2.0/test/fixtures/ts/1/tsconfig.json000066400000000000000000000003141366563455400216730ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp" } } interpret-2.2.0/test/fixtures/ts/2/000077500000000000000000000000001366563455400171675ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ts/2/package.json000066400000000000000000000001331366563455400214520ustar00rootroot00000000000000{ "dependencies": { "typescript": "1.4.1", "typescript-register": "^1.1.0" } } interpret-2.2.0/test/fixtures/ts/2/test.ts000066400000000000000000000002341366563455400205150ustar00rootroot00000000000000var test = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; var main = { default: test }; export = main; interpret-2.2.0/test/fixtures/ts/2/tsconfig.json000066400000000000000000000003141366563455400216740ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp" } } interpret-2.2.0/test/fixtures/ts/3/000077500000000000000000000000001366563455400171705ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ts/3/package.json000066400000000000000000000001001366563455400214450ustar00rootroot00000000000000{ "dependencies": { "typescript-require": "^0.2.10" } } interpret-2.2.0/test/fixtures/ts/3/test.ts000066400000000000000000000002341366563455400205160ustar00rootroot00000000000000var test = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; var main = { default: test }; export = main; interpret-2.2.0/test/fixtures/ts/3/tsconfig.json000066400000000000000000000003141366563455400216750ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp" } } interpret-2.2.0/test/fixtures/ts/4/000077500000000000000000000000001366563455400171715ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ts/4/package.json000066400000000000000000000000651366563455400214600ustar00rootroot00000000000000{ "dependencies": { "sucrase": "^3.12.1" } } interpret-2.2.0/test/fixtures/ts/4/test.ts000066400000000000000000000002341366563455400205170ustar00rootroot00000000000000var test = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } }; var main = { default: test }; export = main; interpret-2.2.0/test/fixtures/ts/4/tsconfig.json000066400000000000000000000003141366563455400216760ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp" } } interpret-2.2.0/test/fixtures/ts/5/000077500000000000000000000000001366563455400171725ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/ts/5/.babelrc000066400000000000000000000002761366563455400205720ustar00rootroot00000000000000{ "presets": [ "@babel/preset-env", "@babel/preset-react", [ "@babel/preset-typescript", { "isTSX": true, "allExtensions": true } ] ] } interpret-2.2.0/test/fixtures/ts/5/component.ts000066400000000000000000000005521366563455400215460ustar00rootroot00000000000000const React = { createElement(Component: () => any) { return Component() } } // Test harmony arrow functions. const Component = () => { var trueKey = true var falseKey = false var subKey = { subProp: 1 } // Test harmony object short notation. return { data: { trueKey, falseKey, subKey } } } // Test TSX syntax. export default interpret-2.2.0/test/fixtures/ts/5/package.json000066400000000000000000000003131366563455400214550ustar00rootroot00000000000000{ "dependencies": { "@babel/core": "^7.2.2", "@babel/preset-env": "^7.2.3", "@babel/preset-react": "^7.0.0", "@babel/preset-typescript": "^7.1.0", "@babel/register": "^7.0.0" } } interpret-2.2.0/test/fixtures/ts/5/test.ts000066400000000000000000000001261366563455400205200ustar00rootroot00000000000000import Component from "./component" var test = { ...Component } export default test interpret-2.2.0/test/fixtures/tsx/000077500000000000000000000000001366563455400172165ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/tsx/0/000077500000000000000000000000001366563455400173555ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/tsx/0/package.json000066400000000000000000000001201366563455400216340ustar00rootroot00000000000000{ "dependencies": { "ts-node": "^7.0.1", "typescript": "^3.2.2" } } interpret-2.2.0/test/fixtures/tsx/0/test.tsx000066400000000000000000000005541366563455400211000ustar00rootroot00000000000000const React = { createElement (Component: () => any) { return Component() } } // Test harmony arrow functions. const Component = () => { var trueKey = true var falseKey = false var subKey = { subProp: 1 } // Test harmony object short notation. return { data: { trueKey, falseKey, subKey } } }; // Test TSX syntax. export default interpret-2.2.0/test/fixtures/tsx/0/tsconfig.json000066400000000000000000000003401366563455400220610ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp", "jsx": "react" } } interpret-2.2.0/test/fixtures/tsx/1/000077500000000000000000000000001366563455400173565ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/tsx/1/package.json000066400000000000000000000001301366563455400216360ustar00rootroot00000000000000{ "dependencies": { "typescript": "~1.6.0", "typescript-node": "^0.1.3" } } interpret-2.2.0/test/fixtures/tsx/1/test.tsx000066400000000000000000000005541366563455400211010ustar00rootroot00000000000000const React = { createElement (Component: () => any) { return Component() } } // Test harmony arrow functions. const Component = () => { var trueKey = true var falseKey = false var subKey = { subProp: 1 } // Test harmony object short notation. return { data: { trueKey, falseKey, subKey } } }; // Test TSX syntax. export default interpret-2.2.0/test/fixtures/tsx/1/tsconfig.json000066400000000000000000000003401366563455400220620ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp", "jsx": "react" } } interpret-2.2.0/test/fixtures/tsx/2/000077500000000000000000000000001366563455400173575ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/tsx/2/package.json000066400000000000000000000000651366563455400216460ustar00rootroot00000000000000{ "dependencies": { "sucrase": "^3.12.1" } } interpret-2.2.0/test/fixtures/tsx/2/test.tsx000066400000000000000000000005541366563455400211020ustar00rootroot00000000000000const React = { createElement (Component: () => any) { return Component() } } // Test harmony arrow functions. const Component = () => { var trueKey = true var falseKey = false var subKey = { subProp: 1 } // Test harmony object short notation. return { data: { trueKey, falseKey, subKey } } }; // Test TSX syntax. export default interpret-2.2.0/test/fixtures/tsx/2/tsconfig.json000066400000000000000000000003401366563455400220630ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "sourceMap": true, "outDir": ".tmp", "jsx": "react" } } interpret-2.2.0/test/fixtures/tsx/3/000077500000000000000000000000001366563455400173605ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/tsx/3/.babelrc000066400000000000000000000002761366563455400207600ustar00rootroot00000000000000{ "presets": [ "@babel/preset-env", "@babel/preset-react", [ "@babel/preset-typescript", { "isTSX": true, "allExtensions": true } ] ] } interpret-2.2.0/test/fixtures/tsx/3/data.tsx000066400000000000000000000001771366563455400210360ustar00rootroot00000000000000var test = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1 } } } export default test interpret-2.2.0/test/fixtures/tsx/3/package.json000066400000000000000000000003131366563455400216430ustar00rootroot00000000000000{ "dependencies": { "@babel/core": "^7.2.2", "@babel/preset-env": "^7.2.3", "@babel/preset-react": "^7.0.0", "@babel/preset-typescript": "^7.1.0", "@babel/register": "^7.0.0" } } interpret-2.2.0/test/fixtures/tsx/3/test.tsx000066400000000000000000000006171366563455400211030ustar00rootroot00000000000000import data from "./data" const React = { createElement(Component: () => any) { return Component() } } // Test harmony arrow functions. const Component = () => { var trueKey = true var falseKey = false var subKey = { subProp: 1 } // Test harmony object short notation. return { data: { trueKey, falseKey, subKey } } } // Test TSX syntax. export default interpret-2.2.0/test/fixtures/wisp/000077500000000000000000000000001366563455400173625ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/wisp/0/000077500000000000000000000000001366563455400175215ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/wisp/0/package.json000066400000000000000000000000621366563455400220050ustar00rootroot00000000000000{ "dependencies": { "wisp": "^0.11.1" } } interpret-2.2.0/test/fixtures/wisp/0/test.wisp000066400000000000000000000001331366563455400214010ustar00rootroot00000000000000(set! module.exports { :data { :falseKey false, :trueKey true, :subKey { :subProp 1 } } }) interpret-2.2.0/test/fixtures/xml/000077500000000000000000000000001366563455400172005ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/xml/0/000077500000000000000000000000001366563455400173375ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/xml/0/package.json000066400000000000000000000000671366563455400216300ustar00rootroot00000000000000{ "dependencies": { "require-xml": "0.0.1" } } interpret-2.2.0/test/fixtures/xml/0/test.xml000066400000000000000000000001461366563455400210410ustar00rootroot00000000000000 true false interpret-2.2.0/test/fixtures/yaml/000077500000000000000000000000001366563455400173425ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/yaml/0/000077500000000000000000000000001366563455400175015ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/yaml/0/package.json000066400000000000000000000000701366563455400217640ustar00rootroot00000000000000{ "dependencies": { "require-yaml": "0.0.1" } } interpret-2.2.0/test/fixtures/yaml/0/test.yaml000066400000000000000000000001011366563455400213340ustar00rootroot00000000000000data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/fixtures/yml/000077500000000000000000000000001366563455400172015ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/yml/0/000077500000000000000000000000001366563455400173405ustar00rootroot00000000000000interpret-2.2.0/test/fixtures/yml/0/package.json000066400000000000000000000000701366563455400216230ustar00rootroot00000000000000{ "dependencies": { "require-yaml": "0.0.1" } } interpret-2.2.0/test/fixtures/yml/0/test.yml000066400000000000000000000001011366563455400210320ustar00rootroot00000000000000data: trueKey: true falseKey: false subKey: subProp: 1 interpret-2.2.0/test/index.js000066400000000000000000000170041366563455400161760ustar00rootroot00000000000000'use strict'; var expect = require('expect'); var path = require('path'); var Module = require('module'); var shell = require('shelljs'); var rechoir = require('rechoir'); var nodeVersion = require('parse-node-version')(process.version); var extensions = require('../').extensions; // Save the original Module._extensions var originalExtensions = Object.keys(Module._extensions); var original = originalExtensions.reduce(function(result, key) { result[key] = require.extensions[key]; return result; }, {}); // Save the original cache keys var originalCacheKeys = Object.keys(require.cache); // Save the original Module.prototype.load because coffee-script overwrites it var originalModuleLoad = Module.prototype.load; function cleanup() { function cleanupCache(key) { if (originalCacheKeys.indexOf(key) === -1) { delete require.cache[key]; } } function cleanupExtensions(ext) { if (originalExtensions.indexOf(ext) === -1) { delete Module._extensions[ext]; } else { Module._extensions[ext] = original[ext]; } } // Restore the require.cache to startup state Object.keys(require.cache).forEach(cleanupCache); // Restore the original Module.prototype.load Module.prototype.load = originalModuleLoad; // Restore the original Module._extensions Object.keys(Module._extensions).forEach(cleanupExtensions); // Cleanup babel global delete global._babelPolyfill; } // These modules need newer node features var minVersions = { '@babel/register': { major: 6, minor: 0 }, buble: { major: 4, minor: 0 }, coffeescript: { major: 6, minor: 0 }, earlgrey: { major: 0, minor: 12 }, esm: { major: 6, minor: 0 }, json5: { major: 6, minor: 0 }, sucrase: { major: 8, minor: 0 }, 'ts-node': { major: 4, minor: 0 }, wisp: { major: 0, minor: 12 }, 'require-xml': { major: 6, minor: 0 }, 'toml-require': { major: 6, minor: 0 }, }; var maxVersions = { 'typescript-require': { major: 10, minor: 0 }, }; describe('interpret.extensions', function() { beforeEach(cleanup); var exts = Object.keys(extensions); var attempts = exts.reduce(function(attempts, ext) { var modules = extensions[ext]; if (!Array.isArray(modules)) { modules = [modules]; } // Skip .node because those are binaries // TODO: maybe we could add a binary to the fixtures? if (ext === '.node') { return attempts; } // We will handle the .mjs tests separately if (ext === '.mjs') { return attempts; } modules.forEach(function(mod, idx) { if (mod && typeof mod !== 'string') { mod = mod.module; } var name = mod || 'no loader'; var fixture = './fixtures/' + ext.slice(1) + '/' + idx + '/test' + ext; if (mod && mod[0] !== '@') { mod = mod.split('/')[0]; } attempts.push({ extension: ext, module: mod, name: name, index: idx, fixture: fixture, }); }); return attempts; }, []); attempts.forEach(function(attempt) { var extension = attempt.extension; var module = attempt.module; var name = attempt.name; var fixture = attempt.fixture; var fixtureDir = path.dirname(fixture); var idx = attempt.index; it('can require ' + extension + ' using ' + name + ' (' + idx + ')', function(done) { var minVersion = minVersions[module]; if (minVersion) { if (nodeVersion.major === 0 && nodeVersion.minor < minVersion.minor) { this.skip(); } else if (nodeVersion.major < minVersion.major) { this.skip(); } } var maxVersion = maxVersions[module]; if (maxVersion) { if (nodeVersion.major > maxVersion.major) { this.skip(); } } this.timeout(0); var expected; process.chdir(path.join(__dirname, fixtureDir)); shell.exec('trash node_modules', { silent: true }); shell.exec('npm install', { silent: true }); // TODO: log failures rechoir.prepare(extensions, fixture); switch (extension) { case '.ts': case '.tsx': case '.esm.js': expected = { default: { data: { trueKey: true, falseKey: false, subKey: { subProp: 1, }, }, }, }; if (module === 'typescript-require') { // This seems to cause an issue because they vm.runInNewContext so use .toMatch to compare expect(require(fixture)).toMatch(expected); } else { expect(require(fixture)).toEqual(expected); } break; case '.csv': expected = [['r1c1','r1c2'], ['r2c1','r2c2']]; expect(require(fixture)).toEqual(expected); break; case '.ini': expected = { data: { trueKey: 'true', falseKey: 'false', subKey: { subProp: '1', }, }, }; expect(require(fixture)).toEqual(expected); break; case '.xml': expected = { data: { trueKey: 'true', falseKey: 'false', subKey: { subProp: '1', }, }, }; expect(require(fixture)).toEqual(JSON.stringify(expected)); break; case '.toml': expected = Object.create(null); expected.data = Object.create(null); expected.data.trueKey = true; expected.data.falseKey = false; expected.data.subKey = Object.create(null); expected.data.subKey.subProp = 1; expect(require(fixture)).toEqual(expected); break; default: expected = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1, }, }, }; expect(require(fixture)).toEqual(expected); } done(); }); }); it('does not error with the .mjs extension', function(done) { var ext = '.mjs'; var fixture = './fixtures/' + ext.slice(1) + '/0/test' + ext; var result = rechoir.prepare(extensions, fixture); expect(Array.isArray(result)).toEqual(true); expect(result[0].moduleName).toEqual(path.join(__dirname, '../mjs-stub')); done(); }); it('the module can be loaded with import(), ignoring the loader', function() { if (nodeVersion.major < 12) { this.skip(); } var ext = '.mjs'; var fixture = './fixtures/' + ext.slice(1) + '/0/test' + ext; rechoir.prepare(extensions, fixture); var expected = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1, }, }, }; // This avoid SyntaxError when parsing on old node versions var imprt = new Function('a', 'return import(a)'); return imprt(fixture) .then(function(result) { expect(result.default).toEqual(expected); }); }); it('stubs .mjs extension with null on old node that do not care about it', function(done) { if (nodeVersion.major > 10) { this.skip(); } var ext = '.mjs'; var fixture = './fixtures/' + ext.slice(1) + '/1/test' + ext; rechoir.prepare(extensions, fixture); var expected = { data: { trueKey: true, falseKey: false, subKey: { subProp: 1, }, }, }; expect(require(fixture)).toEqual(expected); done(); }); });