@tsmodule/tsmodule 41.28.0 → 41.29.0

Sign up to get free protection for your applications and to get access to all the features.
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-WPZUH6WI.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.29.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",
@@ -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,15 @@
1
+ env:
2
+ es2021: true
3
+ node: true
4
+
5
+ extends: standard-with-typescript
6
+ overrides: []
7
+
8
+ parserOptions:
9
+ project: tsconfig.json
10
+ ecmaVersion: latest
11
+ sourceType: module
12
+
13
+ rules: {
14
+ "@typescript-eslint/explicit-function-return-type": off
15
+ }
@@ -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
+ }
@@ -0,0 +1,31 @@
1
+ // Test-level tsconfig.json. Files are not included in parent program.
2
+ {
3
+ "compilerOptions": {
4
+ "strict": true,
5
+ "allowJs": true,
6
+ "lib": ["ESNext"],
7
+ "module": "ESNext",
8
+ "target": "ESNext",
9
+ "checkJs": true,
10
+ "moduleResolution": "node",
11
+ "strictBindCallApply": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "strictFunctionTypes": true,
15
+ "resolveJsonModule": true,
16
+ "strictNullChecks": true,
17
+ "noImplicitThis": true,
18
+ "noImplicitAny": true,
19
+ "alwaysStrict": true,
20
+ "declaration": true,
21
+ "noEmit": true,
22
+ "jsx": "preserve",
23
+ },
24
+ "include": [
25
+ "./**/*"
26
+ ],
27
+ "exclude": [
28
+ "node_modules",
29
+ "dist"
30
+ ]
31
+ }
@@ -0,0 +1,22 @@
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
+ project: tsconfig.json
14
+ ecmaVersion: latest
15
+ sourceType: module
16
+
17
+ plugins:
18
+ - react
19
+
20
+ rules: {
21
+ "@typescript-eslint/explicit-function-return-type": off
22
+ }
@@ -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
  }