111 lines
6.2 KiB
JSON
111 lines
6.2 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "append-transform@^0.4.0",
|
|
"scope": null,
|
|
"escapedName": "append-transform",
|
|
"name": "append-transform",
|
|
"rawSpec": "^0.4.0",
|
|
"spec": ">=0.4.0 <0.5.0",
|
|
"type": "range"
|
|
},
|
|
"/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/istanbul-lib-hook"
|
|
]
|
|
],
|
|
"_from": "append-transform@>=0.4.0 <0.5.0",
|
|
"_id": "append-transform@0.4.0",
|
|
"_inCache": true,
|
|
"_location": "/append-transform",
|
|
"_nodeVersion": "0.10.40",
|
|
"_npmUser": {
|
|
"name": "jamestalmage",
|
|
"email": "james@talmage.io"
|
|
},
|
|
"_npmVersion": "3.4.0",
|
|
"_phantomChildren": {},
|
|
"_requested": {
|
|
"raw": "append-transform@^0.4.0",
|
|
"scope": null,
|
|
"escapedName": "append-transform",
|
|
"name": "append-transform",
|
|
"rawSpec": "^0.4.0",
|
|
"spec": ">=0.4.0 <0.5.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/istanbul-lib-hook"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz",
|
|
"_shasum": "d76ebf8ca94d276e247a36bad44a4b74ab611991",
|
|
"_shrinkwrap": null,
|
|
"_spec": "append-transform@^0.4.0",
|
|
"_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/istanbul-lib-hook",
|
|
"author": {
|
|
"name": "James Talmage",
|
|
"email": "james@talmage.io",
|
|
"url": "github.com/jamestalmage"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/jamestalmage/append-transform/issues"
|
|
},
|
|
"dependencies": {
|
|
"default-require-extensions": "^1.0.0"
|
|
},
|
|
"description": "Install a transform to `require.extensions` that always runs last, even if additional extensions are added later.",
|
|
"devDependencies": {
|
|
"ava": "^0.7.0",
|
|
"coveralls": "^2.11.6",
|
|
"fake-module-system": "^0.3.0",
|
|
"nyc": "^4.0.1",
|
|
"xo": "^0.11.2"
|
|
},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "d76ebf8ca94d276e247a36bad44a4b74ab611991",
|
|
"tarball": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz"
|
|
},
|
|
"engines": {
|
|
"node": ">=0.10.0"
|
|
},
|
|
"files": [
|
|
"index.js"
|
|
],
|
|
"gitHead": "0b737d26fdebbdfb8ed4be096535099ed7da9ab1",
|
|
"homepage": "https://github.com/jamestalmage/append-transform#readme",
|
|
"keywords": [
|
|
"transform",
|
|
"require",
|
|
"append",
|
|
"last",
|
|
"coverage",
|
|
"source-map",
|
|
"extension",
|
|
"module"
|
|
],
|
|
"license": "MIT",
|
|
"maintainers": [
|
|
{
|
|
"name": "jamestalmage",
|
|
"email": "james@talmage.io"
|
|
}
|
|
],
|
|
"name": "append-transform",
|
|
"optionalDependencies": {},
|
|
"readme": "# append-transform [![Build Status](https://travis-ci.org/jamestalmage/append-transform.svg?branch=master)](https://travis-ci.org/jamestalmage/append-transform) [![Coverage Status](https://coveralls.io/repos/jamestalmage/append-transform/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamestalmage/append-transform?branch=master)\n\n> Install a transform to `require.extensions` that always runs last, even if additional extensions are added later.\n\nThe [typical require extension](https://gist.github.com/jamestalmage/df922691475cff66c7e6) looks something like this:\n\n```js\n var myTransform = require('my-transform');\n \n var oldExtension = require.extensions['.js'];\n require.extensions['.js'] = function (module, filename) {\n var oldCompile = module._compile;\n module._compile = function (code, filename) {\n code = myTransform(code);\n module._compile = oldCompile;\n module._compile(code, filename);\n }; \n oldExtension(module, filename);\n };\n```\n\nIn **almost** all cases, that is sufficient and is the method that should be used (check out [`pirates`](https://www.npmjs.com/package/pirates) for an easy way to do it correctly). In **rare** cases you must ensure your transform remains the last one, even if other transforms are added later. For example, `nyc` uses this module to ensure its transform is applied last so it can capture the final source-map information, and ensure any language extensions it can't understand are already transpiled (ES2015 via `babel` for instance).\n\n*WARNING:* You should be sure you *actually* need this, as it takes control away from the user. Your transform remains the last one applied, even as users continue to add more transforms. This is potentially confusing. Coverage libraries like `nyc` (and `istanbul` on which it relies) have valid reasons for doing this, but you should prefer conventional transform installation via [`pirates`](https://www.npmjs.com/package/pirates).\n\nReferences: \n - [Detailed Breakdown of How Require Extensions Work](https://gist.github.com/jamestalmage/df922691475cff66c7e6)\n - The [test suite](https://github.com/jamestalmage/append-transform/blob/master/test/execution-order.js) provides a good overview of how this library manipulates the order in which transforms are applied.\n\n## Install\n\n```\n$ npm install --save append-transform\n```\n\n\n## Usage\n\n```js\nvar appendTransform = require('append-transform');\nvar myTransform = require('my-transform');\n\nappendTransform(function (code, filename) {\n if (myTransform.shouldTransform(filename)) {\n code = myTransform.transform(code);\n }\n return code;\n});\n```\n\n## API\n\n### appendTransform(transformFn, [extension])\n\n#### transformFn\n\nType: `function(code: string, filename: string)` \n*Required*\n\nA callback that modifies the incoming `code` argument in some way, and returns the transformed result. `filename` is provided to filter which files the transform applies to. If a transform should not manipulate a particular file, just return `code` without modifying it. It is fairly common to avoid transforming files in `node_modules`. In that case you may want to use [`node-modules-regexp`](https://www.npmjs.com/package/node-modules-regexp) to help reliably detect `node_modules` paths and avoid transforming them.\n\n\n#### extension\n\nType: `string` \nDefault: `\".js\"`\n\nThe extension for the types of files this transform is capable of handling.\n\n## License\n\nMIT © [James Talmage](http://github.com/jamestalmage)\n",
|
|
"readmeFilename": "readme.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/jamestalmage/append-transform.git"
|
|
},
|
|
"scripts": {
|
|
"test": "xo && nyc --reporter=lcov --reporter=text ava"
|
|
},
|
|
"version": "0.4.0",
|
|
"xo": {
|
|
"ignores": [
|
|
"test.js"
|
|
]
|
|
}
|
|
}
|