From 763f7033c4b8cedf129cac9ec2888a79bfde55fc Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Wed, 22 May 2024 13:07:48 +0200 Subject: [PATCH] exports instead of module --- ink.d.mts | 41 +++++++++++++++++++++++++++++++++++++++++ package.json | 15 +++++++++++++-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 ink.d.mts diff --git a/ink.d.mts b/ink.d.mts new file mode 100644 index 00000000..b36779f2 --- /dev/null +++ b/ink.d.mts @@ -0,0 +1,41 @@ +import { Story, InkList } from './engine/Story' +import { Compiler } from './compiler/Compiler' +import { CompilerOptions } from './compiler/CompilerOptions' +import { PosixFileHandler } from './compiler/FileHandler/PosixFileHandler' +import { JsonFileHandler } from './compiler/FileHandler/JsonFileHandler' + +declare interface Inkjs { + /** + * A Story is the core class that represents a complete Ink narrative, and + * manages runtime evaluation and state. + */ + Story: typeof Story + + /** + * The underlying type for a list item in Ink. + */ + InkList: typeof InkList + + /** + * Compiles Ink stories from source. + */ + Compiler: typeof Compiler + + /** + * Metadata options for a compiler pass. + */ + CompilerOptions: typeof CompilerOptions + + /** + * Resolves and loads Ink sources from a POSIX filesystem. + */ + PosixFileHandler: typeof PosixFileHandler + + /** + * Resolves and loads Ink sources from a JSON hierarchy. + */ + JsonFileHandler: typeof JsonFileHandler +} + +declare let inkjs: Inkjs +export default inkjs diff --git a/package.json b/package.json index e0cc3945..e3890240 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,20 @@ "description": "A javascript port of inkle's ink scripting language (http://www.inklestudios.com/ink/)", "type": "commonjs", "main": "dist/ink-full.js", - "module": "dist/ink-full.mjs", "types": "ink.d.ts", - "files": ["src/engine","src/compiler","ink.d.ts","script/inkjs-compiler.ts"], + "files": ["src/engine","src/compiler","ink.d.ts", "ink.d.mts","script/inkjs-compiler.ts", "dist"], + "exports": { + ".":{ + "types": "./ink.d.mts", + "import": "./dist/ink.mjs", + "default": "./dist/ink.js" + }, + "./full":{ + "types": "./ink.d.mts", + "import": "./dist/ink-full.mjs", + "default": "./dist/ink-full.js" + } + }, "scripts": { "test": "npm run test:typescript && npm run test:javascript", "test:typescript": "jest",