Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.3",
"license": "MIT",
"main": "./lib-node/index_node.js",
"types": "./types/index_node.d.ts",
"module": "./lib/index.js",
"browser": "./lib/index.js",
"exports": {
Expand All @@ -15,8 +16,9 @@
"clean-modules": "rm -rf lib",
"build:node": "tsc -p tsconfig.cjs.json",
"build:web": "tsc -p tsconfig.esm.json",
"build": "npm run clean-modules && npm run build:node && npm run build:web",
"test": "node_modules/.bin/ava"
"build": "npm run clean-modules && npm run build:node && npm run build:web && npm run generate-types",
"test": "node_modules/.bin/ava",
"generate-types": "tsc src/*.ts --declaration --emitDeclarationOnly --outDir types"
},
"devDependencies": {
"@types/node": "^18.11.17",
Expand All @@ -27,6 +29,7 @@
"lib",
"lib-node",
"src",
"types",
"package.json"
]
}
4 changes: 2 additions & 2 deletions test/cjs_initialization.test.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const test = require('ava');

const { initialiseResolver, read_file } = require("../lib/index_node.js");
const { initialiseResolver, read_file } = require("../lib-node/index_node.js");

test('It reads file from file system within read_file using default implementation.', t => {

Expand Down Expand Up @@ -48,4 +48,4 @@ test('It communicates error when resolver is initialized to anything but a funct

t.is(error.message, 'Provided Noir Resolver is not a function, hint: use function(module_id) => NoirSource as second parameter');

});
});
6 changes: 3 additions & 3 deletions test/esm_initialization.test.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* Below tests are commented because they require
* Below tests are commented because they require
* "type": "module", in package.json
* Seems that both CJS and MJS modes are not going to work.
*/
import test from 'ava';

import { initialiseResolver, read_file } from "../lib/index.js";
import { initialiseResolver, read_file } from "../lib-node/index.js";

test('It communicates error when read_file was called before initialiseResolver.', t => {

Expand Down Expand Up @@ -55,4 +55,4 @@ test('It communicates error when resolver is initialized to anything but a funct

t.is(error.message, 'Provided Noir Resolver is not a function, hint: use function(module_id) => NoirSource as second parameter');

});
});
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare let read_file: (source_id: any) => string;
export declare function initialiseResolver(resolver: (source_id: String) => string): void;
2 changes: 2 additions & 0 deletions types/index_node.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { initialiseResolver, read_file } from './index.js';
export { initialiseResolver, read_file };