Add Biome for lint and code quality check #2
64
package.json
64
package.json
|
@ -1,34 +1,34 @@
|
||||||
{
|
{
|
||||||
"name": "laterano",
|
"name": "laterano",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"main": "dist/main.min.js",
|
"main": "dist/main.min.js",
|
||||||
"types": "dist/types.d.ts",
|
"types": "dist/types.d.ts",
|
||||||
"module": "dist/main.min.js",
|
"module": "dist/main.min.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc && rollup -c && npm run cleanup-intermediate",
|
"build": "tsc && rollup -c && npm run cleanup-intermediate",
|
||||||
"prepare": "npm run build",
|
"prepare": "npm run build",
|
||||||
"cleanup-intermediate": "rimraf dist/main.js dist/types"
|
"cleanup-intermediate": "rimraf dist/main.js dist/types"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@git.nas.astrian.moe:Astrian/Laterano.git"
|
"url": "git@git.nas.astrian.moe:Astrian/Laterano.git"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "",
|
"description": "",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"@rollup/plugin-typescript": "^12.1.2",
|
"@rollup/plugin-typescript": "^12.1.2",
|
||||||
"dts-bundle-generator": "^9.5.1",
|
"dts-bundle-generator": "^9.5.1",
|
||||||
"i": "^0.3.7",
|
"i": "^0.3.7",
|
||||||
"npm": "^11.4.0",
|
"npm": "^11.4.0",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.40.2",
|
"rollup": "^4.40.2",
|
||||||
"rollup-plugin-dts": "^6.2.1",
|
"rollup-plugin-dts": "^6.2.1",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"type": "module"
|
"type": "module"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,23 @@ import terser from '@rollup/plugin-terser'
|
||||||
import dts from 'rollup-plugin-dts'
|
import dts from 'rollup-plugin-dts'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
input: 'dist/main.js',
|
input: 'dist/main.js',
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
file: 'dist/main.min.js',
|
file: 'dist/main.min.js',
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
plugins: [terser()],
|
plugins: [terser()],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
plugins: [resolve(), typescript()],
|
plugins: [resolve(), typescript()],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: 'dist/types/main.d.ts',
|
input: 'dist/types/main.d.ts',
|
||||||
output: {
|
output: {
|
||||||
file: 'dist/types.d.ts',
|
file: 'dist/types.d.ts',
|
||||||
format: 'es',
|
format: 'es',
|
||||||
},
|
},
|
||||||
plugins: [dts()],
|
plugins: [dts()],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
92
src/main.ts
92
src/main.ts
|
@ -66,7 +66,11 @@ export default (options: ComponentOptions) => {
|
||||||
this._states = new Proxy(
|
this._states = new Proxy(
|
||||||
{ ...(states || {}) },
|
{ ...(states || {}) },
|
||||||
{
|
{
|
||||||
set: (target: Record<string, unknown>, keyPath: string, value: unknown) => {
|
set: (
|
||||||
|
target: Record<string, unknown>,
|
||||||
|
keyPath: string,
|
||||||
|
value: unknown,
|
||||||
|
) => {
|
||||||
const valueRoute = keyPath.split('.')
|
const valueRoute = keyPath.split('.')
|
||||||
let currentTarget = target
|
let currentTarget = target
|
||||||
for (const i in valueRoute) {
|
for (const i in valueRoute) {
|
||||||
|
@ -74,8 +78,7 @@ export default (options: ComponentOptions) => {
|
||||||
if (Number.parseInt(i) === valueRoute.length - 1) {
|
if (Number.parseInt(i) === valueRoute.length - 1) {
|
||||||
currentTarget[key] = value
|
currentTarget[key] = value
|
||||||
} else {
|
} else {
|
||||||
if (!currentTarget[key])
|
if (!currentTarget[key]) currentTarget[key] = {}
|
||||||
currentTarget[key] = {}
|
|
||||||
currentTarget = currentTarget[key] as Record<string, unknown>
|
currentTarget = currentTarget[key] as Record<string, unknown>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,8 +116,7 @@ export default (options: ComponentOptions) => {
|
||||||
if (Number.parseInt(i) === valueRoute.length - 1)
|
if (Number.parseInt(i) === valueRoute.length - 1)
|
||||||
return currentTarget[key]
|
return currentTarget[key]
|
||||||
|
|
||||||
if (!currentTarget[key])
|
if (!currentTarget[key]) currentTarget[key] = {}
|
||||||
currentTarget[key] = {}
|
|
||||||
currentTarget = currentTarget[key] as Record<string, unknown>
|
currentTarget = currentTarget[key] as Record<string, unknown>
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
|
@ -192,19 +194,19 @@ export default (options: ComponentOptions) => {
|
||||||
if (value !== undefined)
|
if (value !== undefined)
|
||||||
binding.element.setAttribute(binding.attrName, String(value))
|
binding.element.setAttribute(binding.attrName, String(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _scheduleUpdate(elements: Set<HTMLElement>) {
|
private _scheduleUpdate(elements: Set<HTMLElement>) {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
for (const element of elements)
|
for (const element of elements) this._updateElement(element)
|
||||||
this._updateElement(element)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateElement(element: HTMLElement) {
|
private _updateElement(element: HTMLElement) {
|
||||||
const renderFunction = (element as { _renderFunction?: () => string | Node })._renderFunction
|
const renderFunction = (
|
||||||
|
element as { _renderFunction?: () => string | Node }
|
||||||
|
)._renderFunction
|
||||||
if (renderFunction) {
|
if (renderFunction) {
|
||||||
// Set rendering context
|
// Set rendering context
|
||||||
this._currentRenderingElement = element
|
this._currentRenderingElement = element
|
||||||
|
@ -213,8 +215,7 @@ export default (options: ComponentOptions) => {
|
||||||
const result = renderFunction()
|
const result = renderFunction()
|
||||||
|
|
||||||
// Update DOM
|
// Update DOM
|
||||||
if (typeof result === 'string')
|
if (typeof result === 'string') element.innerHTML = result
|
||||||
element.innerHTML = result
|
|
||||||
else if (result instanceof Node) {
|
else if (result instanceof Node) {
|
||||||
element.innerHTML = ''
|
element.innerHTML = ''
|
||||||
element.appendChild(result)
|
element.appendChild(result)
|
||||||
|
@ -349,11 +350,19 @@ export default (options: ComponentOptions) => {
|
||||||
eventName,
|
eventName,
|
||||||
handlerValue,
|
handlerValue,
|
||||||
)
|
)
|
||||||
} else if (typeof (this as Record<string, unknown>)[handlerValue] === 'function') {
|
} else if (
|
||||||
|
typeof (this as Record<string, unknown>)[handlerValue] ===
|
||||||
|
'function'
|
||||||
|
) {
|
||||||
// Handle method reference: @click="handleClick"
|
// Handle method reference: @click="handleClick"
|
||||||
currentElementNode.addEventListener(
|
currentElementNode.addEventListener(
|
||||||
eventName,
|
eventName,
|
||||||
((this as unknown as Record<string, (...args: unknown[]) => void>)[handlerValue]).bind(this),
|
(
|
||||||
|
this as unknown as Record<
|
||||||
|
string,
|
||||||
|
(...args: unknown[]) => void
|
||||||
|
>
|
||||||
|
)[handlerValue].bind(this),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Handle simple expression: @click="count++" or @input="name = $event.target.value"
|
// Handle simple expression: @click="count++" or @input="name = $event.target.value"
|
||||||
|
@ -427,8 +436,7 @@ export default (options: ComponentOptions) => {
|
||||||
this._statesListeners[expr] = (newValue: unknown) => {
|
this._statesListeners[expr] = (newValue: unknown) => {
|
||||||
if (element instanceof HTMLInputElement)
|
if (element instanceof HTMLInputElement)
|
||||||
element.value = newValue as string
|
element.value = newValue as string
|
||||||
else
|
else element.setAttribute('data-laterano-connect', String(newValue))
|
||||||
element.setAttribute('data-laterano-connect', String(newValue))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,15 +518,14 @@ export default (options: ComponentOptions) => {
|
||||||
const keyAttr = template.getAttribute('%key')
|
const keyAttr = template.getAttribute('%key')
|
||||||
if (!keyAttr)
|
if (!keyAttr)
|
||||||
console.warn(
|
console.warn(
|
||||||
'%key attribute not found in the template, which is not a recommended practice.'
|
'%key attribute not found in the template, which is not a recommended practice.',
|
||||||
)
|
)
|
||||||
|
|
||||||
// Store a map of existing items by key for reuse
|
// Store a map of existing items by key for reuse
|
||||||
const existingElementsByKey = new Map()
|
const existingElementsByKey = new Map()
|
||||||
// renderedItems.forEach((item) => {
|
// renderedItems.forEach((item) => {
|
||||||
for (const item of renderedItems)
|
for (const item of renderedItems)
|
||||||
if (item.key !== undefined)
|
if (item.key !== undefined) existingElementsByKey.set(item.key, item)
|
||||||
existingElementsByKey.set(item.key, item)
|
|
||||||
|
|
||||||
// Clear rendered items
|
// Clear rendered items
|
||||||
renderedItems.length = 0
|
renderedItems.length = 0
|
||||||
|
@ -531,12 +538,12 @@ export default (options: ComponentOptions) => {
|
||||||
// Determine the key for this item
|
// Determine the key for this item
|
||||||
const key = keyAttr
|
const key = keyAttr
|
||||||
? this._evaluateExpressionWithItemContext(
|
? this._evaluateExpressionWithItemContext(
|
||||||
keyAttr ?? '',
|
keyAttr ?? '',
|
||||||
item,
|
item,
|
||||||
index,
|
index,
|
||||||
itemVar,
|
itemVar,
|
||||||
indexVar ? indexVar : undefined,
|
indexVar ? indexVar : undefined,
|
||||||
)
|
)
|
||||||
: index
|
: index
|
||||||
|
|
||||||
// Check if we can reuse an existing element
|
// Check if we can reuse an existing element
|
||||||
|
@ -621,7 +628,8 @@ export default (options: ComponentOptions) => {
|
||||||
itemContext: Record<string, unknown>,
|
itemContext: Record<string, unknown>,
|
||||||
) {
|
) {
|
||||||
// 1. Store the item context of the element so that subsequent updates can find it
|
// 1. Store the item context of the element so that subsequent updates can find it
|
||||||
; (element as { _itemContext?: Record<string, unknown> })._itemContext = itemContext
|
;(element as { _itemContext?: Record<string, unknown> })._itemContext =
|
||||||
|
itemContext
|
||||||
|
|
||||||
// 2. Process bindings in text nodes
|
// 2. Process bindings in text nodes
|
||||||
const processTextNodes = (node: Node) => {
|
const processTextNodes = (node: Node) => {
|
||||||
|
@ -647,8 +655,7 @@ export default (options: ComponentOptions) => {
|
||||||
// Process the text nodes of the element itself
|
// Process the text nodes of the element itself
|
||||||
// Array.from(element.childNodes).forEach((node) => {
|
// Array.from(element.childNodes).forEach((node) => {
|
||||||
for (const node of Array.from(element.childNodes))
|
for (const node of Array.from(element.childNodes))
|
||||||
if (node.nodeType === Node.TEXT_NODE)
|
if (node.nodeType === Node.TEXT_NODE) processTextNodes(node)
|
||||||
processTextNodes(node)
|
|
||||||
|
|
||||||
// 3. Process attribute bindings (:attr)
|
// 3. Process attribute bindings (:attr)
|
||||||
// Array.from(element.attributes).forEach((attr) => {
|
// Array.from(element.attributes).forEach((attr) => {
|
||||||
|
@ -661,8 +668,7 @@ export default (options: ComponentOptions) => {
|
||||||
itemContext,
|
itemContext,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (value !== undefined)
|
if (value !== undefined) element.setAttribute(attrName, String(value))
|
||||||
element.setAttribute(attrName, String(value))
|
|
||||||
|
|
||||||
// Remove the original binding attribute (execute only for cloned templates once)
|
// Remove the original binding attribute (execute only for cloned templates once)
|
||||||
element.removeAttribute(attr.name)
|
element.removeAttribute(attr.name)
|
||||||
|
@ -724,8 +730,7 @@ export default (options: ComponentOptions) => {
|
||||||
shouldDisplay = Boolean(result)
|
shouldDisplay = Boolean(result)
|
||||||
|
|
||||||
// Apply the condition (in the list item context, we use display style to simplify)
|
// Apply the condition (in the list item context, we use display style to simplify)
|
||||||
if (!shouldDisplay)
|
if (!shouldDisplay) (element as HTMLElement).style.display = 'none'
|
||||||
(element as HTMLElement).style.display = 'none'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,8 +758,7 @@ export default (options: ComponentOptions) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this element is a list element, skip child element processing (they will be processed by the list processor)
|
// If this element is a list element, skip child element processing (they will be processed by the list processor)
|
||||||
if (hasForDirective)
|
if (hasForDirective) return
|
||||||
return
|
|
||||||
|
|
||||||
// 7. Recursively process all child elements
|
// 7. Recursively process all child elements
|
||||||
// Array.from(element.children).forEach((child) => {
|
// Array.from(element.children).forEach((child) => {
|
||||||
|
@ -853,9 +857,8 @@ export default (options: ComponentOptions) => {
|
||||||
let value = itemContext[itemVar]
|
let value = itemContext[itemVar]
|
||||||
|
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
if (value === undefined || value === null)
|
if (value === undefined || value === null) return undefined
|
||||||
return undefined
|
value = (value as { [key: string]: unknown })[part]
|
||||||
value = (value as { [key: string]: unknown})[part]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
@ -954,8 +957,7 @@ export default (options: ComponentOptions) => {
|
||||||
throw new Error(`Invalid arrow function syntax: ${handlerValue}`)
|
throw new Error(`Invalid arrow function syntax: ${handlerValue}`)
|
||||||
}
|
}
|
||||||
const paramsStr = (() => {
|
const paramsStr = (() => {
|
||||||
if (splitted[0].includes('('))
|
if (splitted[0].includes('(')) return splitted[0].trim()
|
||||||
return splitted[0].trim()
|
|
||||||
return `(${splitted[0].trim()})`
|
return `(${splitted[0].trim()})`
|
||||||
})()
|
})()
|
||||||
const bodyStr = splitted[1].trim()
|
const bodyStr = splitted[1].trim()
|
||||||
|
@ -1028,12 +1030,16 @@ export default (options: ComponentOptions) => {
|
||||||
// Add all methods of the component
|
// Add all methods of the component
|
||||||
// Object.getOwnPropertyNames(Object.getPrototypeOf(this)).forEach(
|
// Object.getOwnPropertyNames(Object.getPrototypeOf(this)).forEach(
|
||||||
// (name) => {
|
// (name) => {
|
||||||
for (const name of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
for (const name of Object.getOwnPropertyNames(
|
||||||
|
Object.getPrototypeOf(this),
|
||||||
|
))
|
||||||
if (
|
if (
|
||||||
typeof (this as Record<string, unknown>)[name] === 'function' &&
|
typeof (this as Record<string, unknown>)[name] === 'function' &&
|
||||||
name !== 'constructor'
|
name !== 'constructor'
|
||||||
)
|
)
|
||||||
context[name] = (this as unknown as Record<string, (...args: unknown[]) => void>)[name].bind(this)
|
context[name] = (
|
||||||
|
this as unknown as Record<string, (...args: unknown[]) => void>
|
||||||
|
)[name].bind(this)
|
||||||
|
|
||||||
return context
|
return context
|
||||||
}
|
}
|
||||||
|
@ -1151,8 +1157,7 @@ export default (options: ComponentOptions) => {
|
||||||
let result = this._states
|
let result = this._states
|
||||||
|
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
if (result === undefined || result === null)
|
if (result === undefined || result === null) return undefined
|
||||||
return undefined
|
|
||||||
result = (result as { [key: string]: Record<string, unknown> })[part]
|
result = (result as { [key: string]: Record<string, unknown> })[part]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1188,8 +1193,7 @@ export default (options: ComponentOptions) => {
|
||||||
const parts = keyPath.split('.')
|
const parts = keyPath.split('.')
|
||||||
let result = this._states
|
let result = this._states
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
if (result === undefined || result === null)
|
if (result === undefined || result === null) return undefined
|
||||||
return undefined
|
|
||||||
result = (result as { [key: string]: Record<string, unknown> })[part]
|
result = (result as { [key: string]: Record<string, unknown> })[part]
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
218
tsconfig.json
218
tsconfig.json
|
@ -1,120 +1,118 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
/* Projects */
|
/* Projects */
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
/* Language and Environment */
|
/* Language and Environment */
|
||||||
"target": "ES6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
"target": "ES6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||||
"lib": ["DOM", "ES2024"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
"lib": [
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
"DOM",
|
||||||
// "libReplacement": true, /* Enable lib replacement. */
|
"ES2024"
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
// "libReplacement": true, /* Enable lib replacement. */
|
||||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
/* Modules */
|
/* Modules */
|
||||||
"module": "ES2022", /* Specify what module code is generated. */
|
"module": "ES2022" /* Specify what module code is generated. */,
|
||||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
// "typeRoots": ["./src/types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
// "typeRoots": ["./src/types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||||
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
||||||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||||
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
||||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
/* JavaScript Support */
|
/* JavaScript Support */
|
||||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
/* Emit */
|
/* Emit */
|
||||||
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
||||||
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
"declarationMap": true /* Create sourcemaps for d.ts files. */,
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||||
"declarationDir": "./dist/types", /* Specify the output directory for generated declaration files. */
|
"declarationDir": "./dist/types" /* Specify the output directory for generated declaration files. */,
|
||||||
|
|
||||||
/* Interop Constraints */
|
/* Interop Constraints */
|
||||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||||
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
||||||
// "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
|
// "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
||||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||||
|
|
||||||
/* Type Checking */
|
/* Type Checking */
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true /* Enable all strict type-checking options. */,
|
||||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
||||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
/* Completeness */
|
/* Completeness */
|
||||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["./src/**/*"],
|
||||||
"./src/**/*"
|
"exclude": ["node_modules", "dist"]
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user