43 lines
2.8 KiB
Plaintext
43 lines
2.8 KiB
Plaintext
|
{
|
||
|
"imports":
|
||
|
{
|
||
|
"react":"https://esm.sh/preact@10.15.1/compat", // (required) Specifier for 'react'
|
||
|
"react/":"https://esm.sh/preact@10.15.1/compat/", // (conditional) This allows the use of JSX without explicitly importing React into a module. If you choose to remove this (and make importing react required), also remove "jsx" and "jsxImportSource" from "compilerOptions" (below)
|
||
|
">able/": "http://localhost:4507/", // (required) Specifier 'able'. (See note below about "isomorphic proxies")
|
||
|
// (required) module with default export ()=>React.JSX.Element">able/app.tsx": "./path/to/app.tsx",
|
||
|
// (optional) module with default export (req:Request, url:URL)=>Promise<Response|false>">able/api.tsx": "./path/to/api.tsx"
|
||
|
},
|
||
|
|
||
|
"tasks":
|
||
|
{
|
||
|
"local": "deno run -A --reload=http://localhost:4507 --no-lock ./run-local.tsx --port=1234",
|
||
|
"serve": "deno run -A --reload=http://localhost:4507 --no-lock ./run-serve.tsx --port=1234",
|
||
|
"cloud": "deno run -A --reload=http://localhost:4507 --no-lock ./run-deploy.tsx",
|
||
|
"debug": "deno run -A --reload=http://localhost:4507 --no-lock --inspect-wait ./run-serve.tsx --port=1234"
|
||
|
},
|
||
|
|
||
|
"compilerOptions":
|
||
|
{
|
||
|
"lib": ["deno.window", "dom"], // makes the Deno Language Server OK with browser-specific code
|
||
|
"jsx": "react-jsx", // see "react/" import above
|
||
|
"jsxImportSource": "react" // ^
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
|
||
|
Imports prefixed with ">" are "isomorphic proxies."
|
||
|
In addition to functioning normally as bare module specifiers for Deno, **these imports are added as routes when the server starts**.
|
||
|
Assuming the specifier points to remotely a hosted directory containing typescript files, requests to your running Able server on these proxy routes are actually fetched from the remote, then transpiled (and cached), then send back as a response.
|
||
|
For example, after the Able server starts, if it sees a web request to '/>able/iso-elements.tsx' it would actually return a browser-friendly transpiled copy of what was on the remote.
|
||
|
Conversely, if the Deno Language Server were to see: `import * as Iso from ">able/iso-elements.tsx";` in one of your modules,
|
||
|
that will be resolved normally with the import map and Deno will just receive the tsx file as-is from the remote, typings and all, so intellisense will work in your IDE.
|
||
|
|
||
|
While ">able/" is a required "import proxy" to pull in Able source code, you are free to use this convention to also add your own proxies as you see fit.
|
||
|
E.g. adding this record to imports:
|
||
|
">your-import/": "https://raw.githubusercontent.com/your-name/your-lib/master/"
|
||
|
will give both Deno and browsers running your Able project everything they need
|
||
|
import CoolComponent from ">your-import/cc.tsx";
|
||
|
...
|
||
|
|
||
|
*/
|
||
|
}
|