{"name":"cross-dirname","version":"0.1.0","type":"commonjs","main":"./dist/cjs/index.cjs","module":"./dist/esm/index.mjs","types":"./dist/types/index.d.ts","exports":{".":{"require":"./dist/cjs/index.cjs","default":"./dist/esm/index.mjs"}},"scripts":{"clear":"rm -rf dist","build":"npm run clear && npm run build:cjs && npm run build:esm && npm run build:types","build:cjs":"tsc && mv ./dist/cjs/index.js ./dist/cjs/index.cjs","build:esm":"tsc --project tsconfig.esm.json && mv ./dist/esm/index.js ./dist/esm/index.mjs","build:types":"tsc --project tsconfig.types.json","test":"npm run test:node && npm run test:deno && npm run test:gjs && npm run test:browser","test:node":"mocha test/node","test:gjs":"node test/browser/esbuild.mjs && gjs -m ./test/gjs/base.test.mjs","test:deno":"deno test ./test/deno/base.test.mjs","test:browser":"npm run test:browser:esm && npm run test:browser:cjs","test:browser:esm":"node test/browser/esbuild.mjs && mocha-headless-chrome --timeout 120000 --polling 1000 -f ./test/browser/index.html","test:browser:cjs":"node test/browser/esbuild.cjs && mocha-headless-chrome --timeout 120000 --polling 1000 -f ./test/browser/index.html"},"keywords":["dirname","cross-platform","esm","cjs","node","deno","gjs"],"url":"https://github.com/JumpLink/cross-dirname","license":"MIT","repository":{"type":"git","url":"git+https://github.com/JumpLink/cross-dirname.git"},"devDependencies":{"chai":"^4.3.6","cross-dirname":"^0.0.6","esbuild":"^0.14.49","esm":"^3.2.25","mocha":"^10.0.0","mocha-headless-chrome":"^4.0.0","typescript":"^4.7.4"},"gitHead":"cf2a0674f338e21e53d752933e748849399cd104","description":"[Node.js](https://nodejs.org) + [Gjs](https://gjs.guide/) + [Deno](https://deno.land/) module that returns the current script dirname and filename. Similar to `__dirname` and `__filename` but also works in CommonJs and ES modules.","bugs":{"url":"https://github.com/JumpLink/cross-dirname/issues"},"homepage":"https://github.com/JumpLink/cross-dirname#readme","_id":"cross-dirname@0.1.0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==","shasum":"b899599f30a5389f59e78c150e19f957ad16a37c","tarball":"http://registry-npm.ywwl.com/cross-dirname/download/cross-dirname-0.1.0.tgz","fileCount":5,"unpackedSize":10449,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHMY7Ji9DJKMm/yuHTeuTfcNxocPSs4HVJTjK+p8bAsaAiEAjl3ORDX2Y7XLtdqaHB7FN7vBQ3iC0QPtPnEA0fCAsDU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2s2YACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohOA/+IhPPGR6MYqjqtmo3bM6HpNE7DmNIeuDkU64paezdGkXVQD5h\r\nGjcRPgAh2Dkk0dpfRLd0Nw+BSHs1b0Ld6ftAfSgCesHBfzKgpeKyDvVQRPvi\r\naMLfyF8kCMzD/YsEMpU0nwwSLh39Sm9iV01tNUudwvphs0L2eQkw6TbCm88K\r\nxYtwjmNUOYvBWhfEWaF/NmSWsZNqzEswNjRCc4Uia0JPVCoZlJS4yGxA2L+W\r\nbhWba4lDt84nk5TdBaaMpyIO/X1lfnhVx9RG15jrJ9q7a2EGs5EupD0peE71\r\napNsOEjO8Z4q5PO6qh2kzzVrt4EAMtmfopwPjkCY6cbceGSLFI4RzFKYRDHd\r\n8BPJnBq2AqNjH2uFE7tNhCLFGvDLSSGdgYmKdQFewnHLjZoOu1zaqF1gGtUF\r\ngWhc//u7VIqIYk2zLvOkWeFc3hqsv/uQWsR49SEFaUjGkdi2EyIYZ8XuVpt6\r\nhbdEQfj8KXoQzqQr+X4Vl8CDIEJD48gHIPs4RoB/36svzA9Z4BomHOuDVxgR\r\nrcTQNgjLl4/SwxfCFS2r8379ukzcEirkRysAJh046WsFYNyp949IQAxN92yE\r\nJbXHyhPCPENBK/eEHi8xBwfP5Rmlh9msUJTYFXUA4+5837y4MsMx3U6LwrLS\r\nElxmgJsr2gSC02zCfoKcGqNsUszKmiMWCNA=\r\n=fPXp\r\n-----END PGP SIGNATURE-----\r\n","size":2732,"noattachment":false,"key":"/cross-dirname/-/cross-dirname-0.1.0.tgz"},"_npmUser":{"name":"jumplink","email":"pascal@artandcode.studio"},"directories":{},"maintainers":[{"name":"jumplink","email":"pascal@artandcode.studio"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cross-dirname_0.1.0_1658506648088_0.6238243332719275"},"_hasShrinkwrap":false,"readme":"# cross-dirname\n\n[Node.js](https://nodejs.org) + [Gjs](https://gjs.guide/) + [Deno](https://deno.land/) module that returns the current script dirname and filename. Similar to `__dirname` and `__filename` but also works in CommonJs and ES modules.  \n\n## Installation\n\nOn Node.js and GJS you can install the package as with NPM:\n\n```\nnpm install cross-dirname --save\n```\n\nOn Deno you just need to import this package:\n\n```ts\nimport { getDirname, getFilename } from 'https://deno.land/x/cross_dirname/mod.ts';\n```\n\n## Usage\n\nPlease do not use `getDirname` and `getFilename` in nested other methods, instead always use them in the root of your file, otherwise it may return wrong results.\n\n### Node.js ESM\n\n```js\n// /path/to/the/script.mjs\nimport { getDirname, getFilename } from 'cross-dirname'\n\nconsole.log(getDirname()) // outputs \"/path/to/the\"\nconsole.log(getFilename()) // outputs \"/path/to/the/script.mjs\"\n```\n\n### Node.js CJS\n\n```js\n// /path/to/the/script.cjs\nconst { getDirname, getFilename } = require('cross-dirname');\n\nconsole.log(getDirname() === __dirname) // true\nconsole.log(getFilename() === __filename) // true\n```\n\n### Deno\n\n```ts\n// /path/to/the/script.ts\nimport { getDirname, getFilename } from 'https://deno.land/x/cross_dirname@v0.0.4/mod.ts';\n\nconsole.log(getDirname()); // outputs \"/path/to/the\"\nconsole.log(getFilename()); // outputs \"/path/to/the/script.ts\"\n```\n\n### GJS\n\nYou can use NPM packages in GJS with a bundler like [esbuild](https://esbuild.github.io/).\n\nTake a look at the examples for an [GJS + esbuild example](/examples/gjs), you can start the example like this: \n\n```bash\n# Install dev dependencies \nnpm install\n\n# Go to the example\ncd examples/gjs\n\n# Bundle src/index.js\nnode esbuild.mjs\n\n# Run the bundled index.js\ngjs -m index.js\n```\n\n### Examples\n\nYou can run the examples with\n\n```bash\n\nnpm install\nnpm run build\n\ndeno run ./examples/deno/index.ts \n# -> /.../examples/deno\n\nnode ./examples/node/index.cjs \n# -> /.../examples/node\n\nnode ./examples/node/index.mjs \n# -> /.../examples/node\n\nnode ./examples/gjs/esbuild.mjs\ngjs -m ./examples/gjs/index.js \n# -> /.../examples/gjs\n```\n\n### Contributions\n\nContributions for more platforms are welcome :)\n\n### Tests\n\nThis module has been tested on the following platforms:\n\n| Runtime | Type   | Platform | State    |\n|---------|--------|----------|----------|\n| Node.js | CJS    | Linux    | ✔        |\n| Node.js | CJS    | MacOS    | ✔        |\n| Node.js | CJS    | Windows  | ✔        |\n| Node.js | ESM    | Linux    | ✔        |\n| Node.js | ESM    | MacOS    | ✔        |\n| Node.js | ESM    | Windows  | ✔        |\n| Deno    | ESM    | Linux    | ✔        |\n| Deno    | ESM    | MacOS    | ✔        |\n| Deno    | ESM    | Windows  | ✔        |\n| Gjs     | ESM    | Linux    | ✔        |\n| Gjs     | ESM    | MacOS    | UNTESTED |\n| Gjs     | ESM    | Windows  | UNTESTED |\n| Chrome  | ESM    | Browser  | ✔        |\n| Chrome  | CJS    | Browser  | ✔        |\n\nYou can run all tests with:\n\n```\nnpm run test\n```\n\nOr the tests for a special runtime:\n\n```\nnpm run test:node\nnpm run test:deno\nnpm run test:gjs\nnpm run test:browser´\n```","publish_time":1658506648289,"_cnpm_publish_time":1658506648289,"dist-tags":{"latest":"0.1.0"}}