@nzyme/esm 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kedrzu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Replacement for __dirname in ESM context.
3
+ * @example const __dirname = dirname(import.meta);
4
+ */
5
+ export declare function dirname(url: string): string;
6
+ export { dirname as getDirname };
@@ -0,0 +1,10 @@
1
+ import { fileURLToPath } from 'url';
2
+ /**
3
+ * Replacement for __dirname in ESM context.
4
+ * @example const __dirname = dirname(import.meta);
5
+ */
6
+ export function dirname(url) {
7
+ return fileURLToPath(new URL('.', url));
8
+ }
9
+ export { dirname as getDirname };
10
+ //# sourceMappingURL=dirname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dirname.js","sourceRoot":"","sources":["../src/dirname.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IAC/B,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Replacement for __filename in ESM context.
3
+ * @example const __filename = filename(import.meta.url);
4
+ */
5
+ export declare function filename(url: string): string;
6
+ export { filename as getFilename };
@@ -0,0 +1,10 @@
1
+ import { fileURLToPath } from 'url';
2
+ /**
3
+ * Replacement for __filename in ESM context.
4
+ * @example const __filename = filename(import.meta.url);
5
+ */
6
+ export function filename(url) {
7
+ return fileURLToPath(url);
8
+ }
9
+ export { filename as getFilename };
10
+ //# sourceMappingURL=filename.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filename.js","sourceRoot":"","sources":["../src/filename.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW;IAChC,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './dirname.js';
2
+ export * from './filename.js';
3
+ export * from './unwrapCjsDefaultImport.js';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './dirname.js';
2
+ export * from './filename.js';
3
+ export * from './unwrapCjsDefaultImport.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Sometimes when importing CJS from ESM context types are not properly inferred.
3
+ */
4
+ export declare function unwrapCjsDefaultImport<T>(value: {
5
+ default: T;
6
+ } | T): T;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Sometimes when importing CJS from ESM context types are not properly inferred.
3
+ */
4
+ export function unwrapCjsDefaultImport(value) {
5
+ return value;
6
+ }
7
+ //# sourceMappingURL=unwrapCjsDefaultImport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrapCjsDefaultImport.js","sourceRoot":"","sources":["../src/unwrapCjsDefaultImport.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAI,KAAyB;IAC/D,OAAO,KAAU,CAAC;AACtB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@nzyme/esm",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": "https://github.com/kedrzu/nzyme.git",
10
+ "author": "Michał Kędrzyński <m.kedrzynski@gmail.com>",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "eslint": "eslint . --fix --cache",
16
+ "build": "tsc --build"
17
+ },
18
+ "devDependencies": {
19
+ "@nzyme/eslint": "^0.1.0",
20
+ "@nzyme/tsconfig": "^0.1.0",
21
+ "@types/node": "^22.10.5"
22
+ },
23
+ "gitHead": "292c98d76c39c9629a99faab3fbfe569bd289ef0"
24
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "@nzyme/tsconfig/base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "tsBuildInfoFile": "./dist/.tsbuildinfo",
6
+ "rootDir": "./src",
7
+ "types": ["@types/node"]
8
+ },
9
+ "include": ["src"],
10
+ "references": []
11
+ }