@tsmodule/tsmodule 20.0.1 → 22.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +1 -1
- package/package.json +13 -13
- package/dist/commands/build/index.d.ts +0 -12
- package/dist/commands/build/lib/emitTsDeclarations.d.ts +0 -1
- package/dist/commands/create/index.d.ts +0 -3
- package/dist/commands/create/lib/createTemplate.d.ts +0 -1
- package/dist/commands/create/lib/rewritePkgJson.d.ts +0 -1
- package/dist/commands/dev/index.d.ts +0 -1
- package/dist/commands/execute/index.d.ts +0 -1
- package/dist/commands/normalize/index.d.ts +0 -19
- package/dist/commands/normalize/lib/typescriptApi.d.ts +0 -13
- package/dist/index.d.ts +0 -2
- package/dist/loader/index.d.ts +0 -11
- package/dist/loader/types.d.ts +0 -22
- package/dist/types/index.d.ts +0 -4
- package/dist/utils/index.d.ts +0 -28
- package/dist/utils/pkgJson.d.ts +0 -2
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
var r="@tsmodule/tsmodule",s="module",m="
|
2
|
+
var r="@tsmodule/tsmodule",s="module",m="22.1.0",d="tsmodule/tsmodule",l="TypeScript Module loader and compiler",a="MIT",c={tsmodule:"dist/index.js"},p={".":"./dist/loader/index.js","./*":"./dist/*/index.js","./package.json":"./package.json"},u="dist/types/index.d.ts",f=[{name:"C. Lewis",email:"ctj.lewis@icloud.com",url:"https://ctjlewis.com"}],b=["dist/","templates/"],g={node:">=14"},h={bootstrap:"node bootstrap.js",bootload:"node --no-warnings --loader ./dist/loader/index.js src/index.ts build -r",prebuild:"yarn bootstrap && yarn bootload && yarn link -f",build:"tsmodule build",dev:"tsmodule dev",lint:"eslint --fix src",prepare:"yarn build -r",prepublishOnly:"yarn build && yarn test",pretest:"yarn build -r",test:"ava --no-worker-threads"},v={"@types/glob":"^7.2.0","@types/node":"^17.0.21","@typescript-eslint/eslint-plugin":"^5.13.0","@typescript-eslint/parser":"^5.13.0",ava:"^4.1.0","await-shell":"^31.0.0",chalk:"^5.0.0",commander:"^9.0.0","create-debug-logger":"^3.0.0",esbuild:"^0.14.25",eslint:"^8.10.0","fast-glob":"^3.2.10","fs-extra":"^10.0.1",glob:"^7.2.0","node-watch":"^0.7.3",ora:"^6.1.0",path:"^0.12.7",typescript:"^4.6.2"},y=["esm","loader","typescript","loader hook","require hook","experimental-loader"],S={timeout:"10 minutes",files:["test/**/*.test.ts"],extensions:{ts:"module"},nodeArguments:["--no-warnings","--loader=@tsmodule/tsmodule"]},w={"@types/fs-extra":"^9.0.13"},t={name:r,type:s,version:m,repository:d,description:l,license:a,bin:c,exports:p,types:u,contributors:f,files:b,engines:g,scripts:h,dependencies:v,keywords:y,ava:S,devDependencies:w};import o from"chalk";import{Command as T}from"commander";import{build as x}from"./commands/build/index.js";import{create as B}from"./commands/create/index.js";import{dev as C}from"./commands/dev/index.js";import{execute as R}from"./commands/execute/index.js";import{normalizeImportSpecifiers as j}from"./commands/normalize/index.js";const{version:A}=t,i=new T;i.name(o.white(o.bold("tsmodule"))).usage(o.white(o.bold("<file | command> [options]"))).description(o.blueBright(`A tool for building TypeScript modules.
|
3
3
|
|
4
4
|
Run TS directly: ${o.bold("tsmodule src/index.ts")}
|
5
5
|
Use a command: ${o.bold("tsmodule build")}`)).version(String(A)),i.command("dev").description("Build and watch for changes.").action(C),i.command("build").option("--files <files>","Files to build","src/**/*").option("--styles <styles>","The styles to build","src/styles/components/index.css").option("-d, --dev","Build development runtime").option("-r, --runtime-only","Do not emit type declarations, only build JS runtime").description("Builds TS files to output in dist/.").action(x),i.command("create <name>").option("--react","Create React component library with Next.js").description("Create a new project.").action(B),i.command("normalize [files]").description(`Rewrites import specifiers in files to ESM-compliant paths.
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tsmodule/tsmodule",
|
3
3
|
"type": "module",
|
4
|
-
"version": "
|
4
|
+
"version": "22.1.0",
|
5
5
|
"repository": "tsmodule/tsmodule",
|
6
6
|
"description": "TypeScript Module loader and compiler",
|
7
7
|
"license": "MIT",
|
@@ -42,23 +42,23 @@
|
|
42
42
|
},
|
43
43
|
"dependencies": {
|
44
44
|
"@types/glob": "^7.2.0",
|
45
|
-
"@types/node": "^17.0.
|
46
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
47
|
-
"@typescript-eslint/parser": "^5.
|
48
|
-
"ava": "^4.0
|
49
|
-
"await-shell": "^
|
45
|
+
"@types/node": "^17.0.21",
|
46
|
+
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
47
|
+
"@typescript-eslint/parser": "^5.13.0",
|
48
|
+
"ava": "^4.1.0",
|
49
|
+
"await-shell": "^31.0.0",
|
50
50
|
"chalk": "^5.0.0",
|
51
|
-
"commander": "^
|
52
|
-
"create-debug-logger": "^
|
53
|
-
"esbuild": "^0.14.
|
54
|
-
"eslint": "^8.
|
51
|
+
"commander": "^9.0.0",
|
52
|
+
"create-debug-logger": "^3.0.0",
|
53
|
+
"esbuild": "^0.14.25",
|
54
|
+
"eslint": "^8.10.0",
|
55
55
|
"fast-glob": "^3.2.10",
|
56
|
-
"fs-extra": "^10.0.
|
56
|
+
"fs-extra": "^10.0.1",
|
57
57
|
"glob": "^7.2.0",
|
58
58
|
"node-watch": "^0.7.3",
|
59
|
-
"ora": "^6.0
|
59
|
+
"ora": "^6.1.0",
|
60
60
|
"path": "^0.12.7",
|
61
|
-
"typescript": "^4.
|
61
|
+
"typescript": "^4.6.2"
|
62
62
|
},
|
63
63
|
"keywords": [
|
64
64
|
"esm",
|
@@ -1,12 +0,0 @@
|
|
1
|
-
export declare const bannerLog: (msg: string) => void;
|
2
|
-
/**
|
3
|
-
* Build TS to JS. This will contain incomplete specifiers like `./foo` which
|
4
|
-
* could mean many things, all of which is handled by the loader which will
|
5
|
-
* resolve them for us.
|
6
|
-
*/
|
7
|
-
export declare const build: ({ files, styles, dev, runtimeOnly, }: {
|
8
|
-
files?: string;
|
9
|
-
styles?: string;
|
10
|
-
dev?: boolean;
|
11
|
-
runtimeOnly?: boolean;
|
12
|
-
}) => Promise<void>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const emitTsDeclarations: (files: string[]) => void;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const createTemplate: (template: string, projectName: string) => Promise<void>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const rewritePkgJson: (projectName: string) => Promise<void>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const dev: () => Promise<void>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const execute: () => Promise<void>;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview
|
3
|
-
* This module contains the logic for normalizing import specifiers. It must use
|
4
|
-
* fully-specified filepaths here, since the bootstrap script will compile it
|
5
|
-
* with esbuild and then use it to normalize emitted output.
|
6
|
-
*/
|
7
|
-
/**
|
8
|
-
* Matches a complete import statement, including the import keyword, as well as
|
9
|
-
* dynamic imports, requires, and export statements.
|
10
|
-
*/
|
11
|
-
export declare const generateImportPattern: (importSource: string) => RegExp;
|
12
|
-
/**
|
13
|
-
* Rewrite an import/export/require statement.
|
14
|
-
*/
|
15
|
-
export declare const rewriteImportStatement: (importStatement: string, specifierToReplace: string, specifierReplacement: string) => string;
|
16
|
-
/**
|
17
|
-
* Rewrite imports in the emitted JS to ESM-compliant paths.
|
18
|
-
*/
|
19
|
-
export declare const normalizeImportSpecifiers: (files?: string) => Promise<any>;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import ts from "typescript";
|
2
|
-
export declare const TS_CONFIG: ts.CompilerOptions;
|
3
|
-
export declare const compilerHost: ts.CompilerHost;
|
4
|
-
interface SpecifierReplacement {
|
5
|
-
specifierToReplace: string;
|
6
|
-
specifierReplacement: string;
|
7
|
-
}
|
8
|
-
/**
|
9
|
-
* Get the rewritten specifiers for a given module. Import/export specifiers
|
10
|
-
* will be resolved ahead-of-time by the TypeScript compiler and returned.
|
11
|
-
*/
|
12
|
-
export declare const getRewrittenSpecifiers: (modulePath: string) => SpecifierReplacement[];
|
13
|
-
export {};
|
package/dist/index.d.ts
DELETED
package/dist/loader/index.d.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { GetFormatHook as ModuleGetFormatHook, LoadHook as ModuleLoadHook, ResolveHook as ModuleResolveHook, TransformHook as ModuleTransformSourceHook } from "./types";
|
2
|
-
export declare const resolve: ModuleResolveHook;
|
3
|
-
export declare const load: ModuleLoadHook;
|
4
|
-
/**
|
5
|
-
* @deprecated As of Node 17.
|
6
|
-
*/
|
7
|
-
export declare const getFormat: ModuleGetFormatHook;
|
8
|
-
/**
|
9
|
-
* @deprecated As of Node 17.
|
10
|
-
*/
|
11
|
-
export declare const transformSource: ModuleTransformSourceHook;
|
package/dist/loader/types.d.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
export declare type Promisable<T> = Promise<T> | T;
|
2
|
-
export declare type ModuleSource = string | SharedArrayBuffer | Uint8Array;
|
3
|
-
export declare type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm";
|
4
|
-
export declare type ResolveHook = (specifier: string, context: {
|
5
|
-
conditions: string[];
|
6
|
-
parentURL?: string;
|
7
|
-
}, fallback: ResolveHook) => Promisable<{
|
8
|
-
url: string;
|
9
|
-
format?: ModuleFormat;
|
10
|
-
}>;
|
11
|
-
export declare type GetFormatHook = (url: string, context: object, fallback: GetFormatHook) => Promisable<{
|
12
|
-
format: ModuleFormat;
|
13
|
-
}>;
|
14
|
-
export declare type TransformHook = (source: ModuleSource, context: Record<"url" | "format", string>, fallback: TransformHook) => Promisable<{
|
15
|
-
source: ModuleSource;
|
16
|
-
}>;
|
17
|
-
export declare type LoadHook = (url: string, context: {
|
18
|
-
format?: ModuleFormat;
|
19
|
-
}, fallback: LoadHook) => Promisable<{
|
20
|
-
format: ModuleFormat;
|
21
|
-
source: ModuleSource;
|
22
|
-
}>;
|
package/dist/types/index.d.ts
DELETED
package/dist/utils/index.d.ts
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
export declare const DEVELOPMENT_MODE: boolean;
|
2
|
-
export declare const isTs: RegExp;
|
3
|
-
export declare const isJs: RegExp;
|
4
|
-
export declare const isTsxOrJsx: RegExp;
|
5
|
-
export declare const isJsOrTs: RegExp;
|
6
|
-
export declare const BASE_CONFIG: {
|
7
|
-
format: string;
|
8
|
-
charset: string;
|
9
|
-
sourcemap: string;
|
10
|
-
target: string;
|
11
|
-
minify: boolean;
|
12
|
-
};
|
13
|
-
export declare type ModuleLoaders = {
|
14
|
-
[extension: string]: {
|
15
|
-
[configKey: string]: unknown;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
export declare const MODULE_LOADERS: ModuleLoaders;
|
19
|
-
export declare const POSSIBLE_EXTENSIONS: string[];
|
20
|
-
/**
|
21
|
-
* Force a Unix-like path.
|
22
|
-
*/
|
23
|
-
export declare const normalizeSpecifier: (specifier: string) => string;
|
24
|
-
export declare const fileExists: (fileUrl: string) => string | void;
|
25
|
-
export declare const fileExistsAny: (fileUrls: string[]) => string | void;
|
26
|
-
export declare const checkTsExtensions: (specifier: string) => string | void;
|
27
|
-
export declare const checkJsExtension: (specifier: string) => string | void;
|
28
|
-
export declare const checkExtensions: (specifier: string) => string;
|
package/dist/utils/pkgJson.d.ts
DELETED