@tsmodule/tsmodule 41.28.0 → 41.30.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.
@@ -11,4 +11,4 @@ var D=Object.create;var y=Object.defineProperty;var V=Object.getOwnPropertyDescr
11
11
 
12
12
  `,...r),c.log()},group(){c.log();let r=P.bgBlue.white(` [${e}] `);c.group(r),c.log()},groupEnd(){c.log(`
13
13
  `,"-".repeat(20),`
14
- `),c.groupEnd()}}}else return{log(){},group(){},groupEnd(){}}};if(typeof process<"u"){let{dirname:t}=await import("path"),{fileURLToPath:e}=await import("url");globalThis.__filename=e(import.meta.url),globalThis.__dirname=t(globalThis.__filename);let{default:r}=await import("module");globalThis.require=r.createRequire(import.meta.url)}var Ce=(...t)=>{console.log(),console.log(...t),console.log()};if(typeof process<"u"){let{dirname:t}=await import("path"),{fileURLToPath:e}=await import("url");globalThis.__filename=e(import.meta.url),globalThis.__dirname=t(globalThis.__filename);let{default:r}=await import("module");globalThis.require=r.createRequire(import.meta.url)}if(typeof process<"u"){let{dirname:t}=await import("path"),{fileURLToPath:e}=await import("url");globalThis.__filename=e(import.meta.url),globalThis.__dirname=t(globalThis.__filename);let{default:r}=await import("module");globalThis.require=r.createRequire(import.meta.url)}import{existsSync as ae}from"fs";import{fileURLToPath as ue}from"url";var De=/\.[mc]?tsx?(?=\?|$)/,Ve=/\.([mc])?js$/,ke=/\.([mc])?[tj]sx$/,Ge=/\.([mc])?[tj]sx?$/,p={format:"esm",charset:"utf8",sourcemap:"inline",target:"node16",minify:!1},ce={".mts":{...p,loader:"ts"},".jsx":{...p,loader:"jsx"},".tsx":{...p,loader:"tsx"},".cts":{...p,loader:"ts"},".ts":{...p,loader:"ts"},".json":{...p,loader:"json"}},S=Object.keys(ce);var ge=t=>{let e=ue(t);if(ae(e))return t},$=t=>{for(let e of t)if(ge(e))return e},me=t=>{let e=S.filter(r=>r.includes("ts")).concat([".js"]);return $(e.map(r=>t+r))},pe=t=>{let e=S.filter(r=>r.includes("js")).concat([".js"]);return $(e.map(r=>t+r))},Ue=t=>{let e=pe(t);if(e)return e;let r=me(t);if(r)return r};export{fe as a,be as b,he as c,se as d,Ce as e,De as f,Ve as g,ke as h,Ge as i,ce as j,ge as k,me as l,Ue as m};
14
+ `),c.groupEnd()}}}else return{log(){},group(){},groupEnd(){}}};if(typeof process<"u"){let{dirname:t}=await import("path"),{fileURLToPath:e}=await import("url");globalThis.__filename=e(import.meta.url),globalThis.__dirname=t(globalThis.__filename);let{default:r}=await import("module");globalThis.require=r.createRequire(import.meta.url)}var Ce=(...t)=>{console.log(),console.log(...t),console.log()};if(typeof process<"u"){let{dirname:t}=await import("path"),{fileURLToPath:e}=await import("url");globalThis.__filename=e(import.meta.url),globalThis.__dirname=t(globalThis.__filename);let{default:r}=await import("module");globalThis.require=r.createRequire(import.meta.url)}if(typeof process<"u"){let{dirname:t}=await import("path"),{fileURLToPath:e}=await import("url");globalThis.__filename=e(import.meta.url),globalThis.__dirname=t(globalThis.__filename);let{default:r}=await import("module");globalThis.require=r.createRequire(import.meta.url)}import{existsSync as ae}from"fs";import{fileURLToPath as ue}from"url";var De=!1,Ve=/\.[mc]?tsx?(?=\?|$)/,ke=/\.([mc])?js$/,Ge=/\.([mc])?[tj]sx$/,Ue=/\.([mc])?[tj]sx?$/,p={format:"esm",charset:"utf8",sourcemap:"inline",target:"node16",minify:!1},ce={".mts":{...p,loader:"ts"},".jsx":{...p,loader:"jsx"},".tsx":{...p,loader:"tsx"},".cts":{...p,loader:"ts"},".ts":{...p,loader:"ts"},".json":{...p,loader:"json"}},S=Object.keys(ce);var ge=t=>{let e=ue(t);if(ae(e))return t},$=t=>{for(let e of t)if(ge(e))return e},me=t=>{let e=S.filter(r=>r.includes("ts")).concat([".js"]);return $(e.map(r=>t+r))},pe=t=>{let e=S.filter(r=>r.includes("js")).concat([".js"]);return $(e.map(r=>t+r))},Ye=t=>{let e=pe(t);if(e)return e;let r=me(t);if(r)return r};export{fe as a,be as b,he as c,se as d,Ce as e,De as f,Ve as g,ke as h,Ge as i,Ue as j,ce as k,ge as l,me as m,Ye as n};
package/dist/index.js CHANGED
@@ -3,4 +3,4 @@
3
3
  if(typeof process<"u"){let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");globalThis.__filename=i(import.meta.url),globalThis.__dirname=e(globalThis.__filename);let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}
4
4
  /** __ESM_SHIM_END */
5
5
 
6
- import{c as o,d as r,e,f,g as m,h as p,k as t,l as x,m as a}from"./chunk-6WWVW6W6.js";import"./chunk-SXU4PYPZ.js";export{e as bannerError,r as bannerLog,f as build,m as buildCommand,t as create,x as dev,a as execute,o as normalizeImportSpecifiers,p as specification};
6
+ import{c as o,d as r,e,f,g as m,h as p,k as t,l as x,m as a}from"./chunk-6LF4G2LH.js";import"./chunk-UNZJKJGP.js";export{e as bannerError,r as bannerLog,f as build,m as buildCommand,t as create,x as dev,a as execute,o as normalizeImportSpecifiers,p as specification};
@@ -3,4 +3,4 @@
3
3
  if(typeof process<"u"){let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");globalThis.__filename=i(import.meta.url),globalThis.__dirname=e(globalThis.__filename);let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}
4
4
  /** __ESM_SHIM_END */
5
5
 
6
- import{d as u,f as h,g as v,j as c,k as x,l as k,m as R}from"../chunk-SXU4PYPZ.js";import{extname as m,isAbsolute as F,join as S,normalize as M,resolve as T}from"path";import{posix as D}from"path";import{win32 as b}from"path";import{fileURLToPath as C,pathToFileURL as w,URL as U}from"url";import{readFile as G}from"fs/promises";import{transform as E}from"esbuild";var y=async(o,r,t)=>{let{parentURL:s}=r,e=u(y);if(e.log("Resolving specifier:",{importedFromURL:s,specifier:o}),!o.startsWith(".")&&!F(o))return e.log("Using defaultResolve for named module:",{specifier:o}),t(o,r,t);let{href:l}=w(process.cwd()),{href:i}=new U(s||l);e.log("Finding import URL for",{specifier:o,baseURL:i});let n=o;o.startsWith("file://")||(F(o)?(e.log("Setting import URL to absolute specifier."),n=w(T(M(o))).href):(e.log("Setting import URL relative to baseURL."),n=new U(o,i).href),e.log("Resolved import URL:",{importedFileURL:n,importedFromURL:s}));let d=m(s??"").toLowerCase(),f=m(n).toLowerCase();if(e.log("Rewriting file extension:",{parentExtension:d,specifierExtension:f}),f){let a=n.substring(0,n.lastIndexOf(f));if(e.log("Re-resolving specifier:",{unresolvedSpecifier:a}),v.test(f)&&h.test(d)){let L=k(a);if(L)return e.log("Found JS import in TS:",{unresolvedSpecifier:a,resolvedTsSourceFile:L}),{url:L,shortCircuit:!0}}return x(a)?(e.log("Found file at unresolved specifier:",{unresolvedSpecifier:a}),{url:a,shortCircuit:!0}):t(o,r,t)}e.log("Resolving incomplete URL import to file:",{specifier:o});let g=R(n);if(g)return e.log("Resolved import URL to file:",{resolvedFile:g}),{url:g,shortCircuit:!0};let H=new U(S(n,"index")).href,p=R(H);return p?(e.log("Resolved import URL to index file:",{resolvedIndexFile:p}),{url:p,shortCircuit:!0}):t(o,r,t)},N=async(o,r,t)=>{let s=u(N);if(s.log("Loading source file:",{url:o}),!o.includes(b.sep)&&!o.includes(D.sep))return s.log("Using defaultLoad for named module:",{url:o}),t(o,r,t);let e=m(o),l=c[e];if(!l)return s.log("No loader found, using defaultLoad:",{url:o}),t(o,r,t);let i=C(o),n=await G(i,"utf8");return{format:"module",source:(await E(n.toString(),{...l,sourcefile:i,format:"esm"})).code,shortCircuit:!0}},B=async(o,r,t)=>{let s=u(B);s.log("Getting format for source file:",{url:o});let e=m(o);return c[e]?{format:"module"}:(s.log("No loader found, using default format:",{url:o}),t(o,r,t))},O=async(o,r,t)=>{let s=u(O);s.log("Transforming source from context:",{context:r});let{url:e}=r,l=m(e),i=c[l];return i?{source:(await E(o.toString(),{...i,logLevel:"info",charset:"utf8",target:"esnext",sourcefile:r.url,format:r.format==="module"?"esm":"cjs"})).code}:(s.log("No loader found, using default transformer:",{url:e}),t(o,r,t))};export{B as getFormat,N as load,y as resolve,O as transformSource};
6
+ import{d as u,g as h,h as v,k as c,l as x,m as k,n as R}from"../chunk-UNZJKJGP.js";import{extname as m,isAbsolute as F,join as S,normalize as M,resolve as T}from"path";import{posix as D}from"path";import{win32 as b}from"path";import{fileURLToPath as C,pathToFileURL as w,URL as U}from"url";import{readFile as G}from"fs/promises";import{transform as E}from"esbuild";var y=async(o,r,t)=>{let{parentURL:s}=r,e=u(y);if(e.log("Resolving specifier:",{importedFromURL:s,specifier:o}),!o.startsWith(".")&&!F(o))return e.log("Using defaultResolve for named module:",{specifier:o}),t(o,r,t);let{href:l}=w(process.cwd()),{href:i}=new U(s||l);e.log("Finding import URL for",{specifier:o,baseURL:i});let n=o;o.startsWith("file://")||(F(o)?(e.log("Setting import URL to absolute specifier."),n=w(T(M(o))).href):(e.log("Setting import URL relative to baseURL."),n=new U(o,i).href),e.log("Resolved import URL:",{importedFileURL:n,importedFromURL:s}));let d=m(s??"").toLowerCase(),f=m(n).toLowerCase();if(e.log("Rewriting file extension:",{parentExtension:d,specifierExtension:f}),f){let a=n.substring(0,n.lastIndexOf(f));if(e.log("Re-resolving specifier:",{unresolvedSpecifier:a}),v.test(f)&&h.test(d)){let L=k(a);if(L)return e.log("Found JS import in TS:",{unresolvedSpecifier:a,resolvedTsSourceFile:L}),{url:L,shortCircuit:!0}}return x(a)?(e.log("Found file at unresolved specifier:",{unresolvedSpecifier:a}),{url:a,shortCircuit:!0}):t(o,r,t)}e.log("Resolving incomplete URL import to file:",{specifier:o});let g=R(n);if(g)return e.log("Resolved import URL to file:",{resolvedFile:g}),{url:g,shortCircuit:!0};let H=new U(S(n,"index")).href,p=R(H);return p?(e.log("Resolved import URL to index file:",{resolvedIndexFile:p}),{url:p,shortCircuit:!0}):t(o,r,t)},N=async(o,r,t)=>{let s=u(N);if(s.log("Loading source file:",{url:o}),!o.includes(b.sep)&&!o.includes(D.sep))return s.log("Using defaultLoad for named module:",{url:o}),t(o,r,t);let e=m(o),l=c[e];if(!l)return s.log("No loader found, using defaultLoad:",{url:o}),t(o,r,t);let i=C(o),n=await G(i,"utf8");return{format:"module",source:(await E(n.toString(),{...l,sourcefile:i,format:"esm"})).code,shortCircuit:!0}},B=async(o,r,t)=>{let s=u(B);s.log("Getting format for source file:",{url:o});let e=m(o);return c[e]?{format:"module"}:(s.log("No loader found, using default format:",{url:o}),t(o,r,t))},O=async(o,r,t)=>{let s=u(O);s.log("Transforming source from context:",{context:r});let{url:e}=r,l=m(e),i=c[l];return i?{source:(await E(o.toString(),{...i,logLevel:"info",charset:"utf8",target:"esnext",sourcefile:r.url,format:r.format==="module"?"esm":"cjs"})).code}:(s.log("No loader found, using default transformer:",{url:e}),t(o,r,t))};export{B as getFormat,N as load,y as resolve,O as transformSource};
package/package.json CHANGED
@@ -2,15 +2,13 @@
2
2
  "name": "@tsmodule/tsmodule",
3
3
  "platform": "node",
4
4
  "type": "module",
5
- "version": "41.28.0",
5
+ "version": "41.30.0",
6
6
  "repository": "tsmodule/tsmodule",
7
7
  "description": "TypeScript Module loader and compiler",
8
8
  "license": "MIT",
9
9
  "types": "dist/types/index.d.ts",
10
10
  "module": "dist/bin.js",
11
- "bin": {
12
- "tsmodule": "dist/bin.js"
13
- },
11
+ "bin": "dist/bin.js",
14
12
  "exports": {
15
13
  ".": "./dist/bin.js",
16
14
  "./*": "./dist/*/index.js",
@@ -28,7 +26,7 @@
28
26
  "scripts": {
29
27
  "prebootload": "node scripts/bootstrap.js",
30
28
  "bootload": "node --no-warnings --loader ./dist/loader/index.js src/index.ts build -r",
31
- "prebuild": "yarn bootload && npm link -f --no-save --scripts-prepend-node-path",
29
+ "prebuild": "yarn bootload && npm link -f --no-save",
32
30
  "build": "node dist/bin.js build --standalone \"src/{index.ts,bin.ts,loader/index.ts}\"",
33
31
  "dev": "node dist/bin.js dev",
34
32
  "test-bundle": "yarn build && ava",
@@ -39,7 +37,7 @@
39
37
  "prepublishOnly": "node scripts/prepublish.js"
40
38
  },
41
39
  "dependencies": {
42
- "esbuild": "^0.15.16",
40
+ "esbuild": "^0.17.8",
43
41
  "typescript": "^4.9.3"
44
42
  },
45
43
  "devDependencies": {
@@ -48,9 +46,9 @@
48
46
  "@typescript-eslint/eslint-plugin": "^5.44.0",
49
47
  "@typescript-eslint/parser": "^5.44.0",
50
48
  "assert": "^2.0.0",
51
- "ava": "^5.1.0",
49
+ "ava": "^5.2.0",
52
50
  "chalk": "^5.1.2",
53
- "commander": "^9.4.1",
51
+ "commander": "^10.0.0",
54
52
  "debug-logging": "^4.1.2",
55
53
  "es-module-lexer": "^1.1.0",
56
54
  "eslint": "^8.28.0",
@@ -60,7 +58,7 @@
60
58
  "ora": "^6.1.2",
61
59
  "path": "^0.12.7",
62
60
  "release-it": "^15.5.0",
63
- "universal-shell": "^35.0.7"
61
+ "universal-shell": "^35.0.10"
64
62
  },
65
63
  "release-it": {
66
64
  "git": {
@@ -89,5 +87,6 @@
89
87
  "email": "ctj.lewis@icloud.com",
90
88
  "url": "https://ctjlewis.com"
91
89
  }
92
- ]
90
+ ],
91
+ "packageManager": "yarn@3.4.1"
93
92
  }
@@ -0,0 +1,17 @@
1
+ env:
2
+ es2021: true
3
+ node: true
4
+
5
+ extends: standard-with-typescript
6
+ overrides: []
7
+
8
+ parserOptions:
9
+ ecmaVersion: latest
10
+ sourceType: module
11
+ project:
12
+ - tsconfig.json
13
+ - tsconfig.tests.json
14
+
15
+ rules: {
16
+ "@typescript-eslint/explicit-function-return-type": off
17
+ }
@@ -1,4 +1,3 @@
1
1
  export const helloWorld = () => {
2
- // eslint-disable-next-line no-console
3
- console.log("Hello World!");
4
- };
2
+ console.log('Hello World!')
3
+ }
@@ -1,7 +1,8 @@
1
- import test from "ava";
1
+ /* eslint-disable no-constant-condition */
2
+ import test from 'ava'
2
3
 
3
- test("two plus two should equal four", (t) => {
4
+ test('two plus two should equal four', (t) => {
4
5
  if (2 + 2 === 4) {
5
- t.pass();
6
+ t.pass()
6
7
  }
7
- });
8
+ })
@@ -0,0 +1,34 @@
1
+ {
2
+ "include": ["src/**/*", "test/**/*"],
3
+ "exclude": ["node_modules", "dist"],
4
+ "compilerOptions": {
5
+ "allowJs": true,
6
+ "allowSyntheticDefaultImports": true,
7
+ "alwaysStrict": true,
8
+ "checkJs": false,
9
+ "declaration": true,
10
+ "noEmit": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "incremental": false,
13
+ "isolatedModules": true,
14
+ "jsx": "preserve",
15
+ "lib": ["ESNext", "DOM"],
16
+ "module": "ESNext",
17
+ "moduleResolution": "node",
18
+ "noFallthroughCasesInSwitch": true,
19
+ "noImplicitAny": true,
20
+ "noImplicitReturns": true,
21
+ "noImplicitThis": true,
22
+ "noUnusedLocals": true,
23
+ "noUnusedParameters": true,
24
+ "outDir": "dist",
25
+ "resolveJsonModule": true,
26
+ "rootDir": "",
27
+ "skipLibCheck": true,
28
+ "strict": true,
29
+ "strictBindCallApply": true,
30
+ "strictFunctionTypes": true,
31
+ "strictNullChecks": true,
32
+ "target": "ESNext"
33
+ }
34
+ }
@@ -0,0 +1,24 @@
1
+ env:
2
+ browser: true
3
+ es2021: true
4
+ node: true
5
+
6
+ extends:
7
+ - plugin:react/recommended
8
+ - standard-with-typescript
9
+ - next
10
+
11
+ overrides: []
12
+ parserOptions:
13
+ ecmaVersion: latest
14
+ sourceType: module
15
+ project:
16
+ - tsconfig.json
17
+ - tsconfig.tests.json
18
+
19
+ plugins:
20
+ - react
21
+
22
+ rules: {
23
+ "@typescript-eslint/explicit-function-return-type": off
24
+ }
@@ -1,18 +1,5 @@
1
- module.exports = {
1
+ const nextConfig = {
2
2
  reactStrictMode: true,
3
- webpack: (config) => {
4
- // config.experiments = { topLevelAwait: true };
5
- // config.resolve.fallback = {
6
- // assert: false,
7
- // process: false,
8
- // events: false,
9
- // fs: false,
10
- // util: false,
11
- // path: false,
12
- // stream: false,
13
- // constants: false,
14
- // os: false,
15
- // };
16
- return config;
17
- },
18
3
  };
4
+
5
+ export default nextConfig;
@@ -1,7 +1,7 @@
1
- import { FC, PropsWithChildren } from "react";
1
+ import { type FC, type PropsWithChildren } from 'react'
2
2
 
3
3
  interface CardProps extends PropsWithChildren {
4
- href: string;
4
+ href: string
5
5
  }
6
6
 
7
7
  export const Card: FC<CardProps> = ({ href, children }) => {
@@ -9,5 +9,5 @@ export const Card: FC<CardProps> = ({ href, children }) => {
9
9
  <a href={href} className="card">
10
10
  {children}
11
11
  </a>
12
- );
13
- };
12
+ )
13
+ }
@@ -1,4 +1,4 @@
1
- import { Card } from "../Card";
1
+ import { Card } from '../Card'
2
2
 
3
3
  export const CardGrid = () => {
4
4
  return (
@@ -25,5 +25,5 @@ export const CardGrid = () => {
25
25
  </p>
26
26
  </Card>
27
27
  </div>
28
- );
29
- };
28
+ )
29
+ }
@@ -1,4 +1,4 @@
1
- import Image from "next/image";
1
+ import Image from 'next/image'
2
2
 
3
3
  export const Footer = () => {
4
4
  return (
@@ -9,11 +9,11 @@ export const Footer = () => {
9
9
  target="_blank"
10
10
  rel="noopener noreferrer"
11
11
  >
12
- Powered by{" "}
12
+ Powered by{' '}
13
13
  <span className="h-4 ml-2 flex-center">
14
14
  <Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
15
15
  </span>
16
16
  </a>
17
17
  </footer>
18
- );
19
- };
18
+ )
19
+ }
@@ -1,8 +1,8 @@
1
1
  export const GetStarted = () => {
2
2
  return (
3
3
  <p className="text-gray-700 text-center font-size-3">
4
- Get started by editing{" "}
4
+ Get started by editing{' '}
5
5
  <code className="code">pages/index.js</code>.
6
6
  </p>
7
- );
8
- };
7
+ )
8
+ }
@@ -3,5 +3,5 @@ export const Welcome = () => {
3
3
  <h1 className="text-center">
4
4
  Welcome to <a href="https://nextjs.org">Next.js!</a>
5
5
  </h1>
6
- );
7
- };
6
+ )
7
+ }
@@ -1,4 +1,4 @@
1
- export * from "./Card";
2
- export * from "./CardGrid";
3
- export * from "./GetStarted";
4
- export * from "./Welcome";
1
+ export * from './Card'
2
+ export * from './CardGrid'
3
+ export * from './GetStarted'
4
+ export * from './Welcome'
@@ -1 +1 @@
1
- export * from "./components";
1
+ export * from './components'
@@ -1,14 +1,14 @@
1
- import "../index.css";
1
+ import '../index.css'
2
2
 
3
- import type { AppProps } from "next/app";
4
- import { StrictMode } from "react";
3
+ import type { AppProps } from 'next/app'
4
+ import { StrictMode } from 'react'
5
5
 
6
- function App({ Component, pageProps }: AppProps) {
6
+ function App ({ Component, pageProps }: AppProps) {
7
7
  return (
8
8
  <StrictMode>
9
9
  <Component {...pageProps} />
10
10
  </StrictMode>
11
- );
11
+ )
12
12
  }
13
13
 
14
- export default App;
14
+ export default App
@@ -1,13 +1,13 @@
1
1
  // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2
- import type { NextApiRequest, NextApiResponse } from "next";
2
+ import type { NextApiRequest, NextApiResponse } from 'next'
3
3
 
4
- type Data = {
4
+ interface Data {
5
5
  name: string
6
- };
6
+ }
7
7
 
8
- export default function handler(
8
+ export default function handler (
9
9
  _: NextApiRequest,
10
10
  res: NextApiResponse<Data>
11
11
  ) {
12
- res.status(200).json({ name: "John Doe" });
12
+ res.status(200).json({ name: 'John Doe' })
13
13
  }
@@ -1,11 +1,11 @@
1
- import Head from "next/head";
1
+ import Head from 'next/head'
2
2
 
3
- import { CardGrid } from "../components/CardGrid";
4
- import { Footer } from "../components/Footer";
5
- import { GetStarted } from "../components/GetStarted";
6
- import { Welcome } from "../components/Welcome";
3
+ import { CardGrid } from '../components/CardGrid'
4
+ import { Footer } from '../components/Footer'
5
+ import { GetStarted } from '../components/GetStarted'
6
+ import { Welcome } from '../components/Welcome'
7
7
 
8
- export default function Home() {
8
+ export default function Home () {
9
9
  return (
10
10
  <>
11
11
  <Head>
@@ -22,5 +22,5 @@ export default function Home() {
22
22
 
23
23
  <Footer />
24
24
  </>
25
- );
25
+ )
26
26
  }