embedded-ts
Advanced tools
Comparing version 0.3.2 to 0.3.4
@@ -0,3 +1,3 @@ | ||
import * as fs from 'node:fs'; | ||
import { program } from 'commander'; | ||
import * as fs from 'node:fs'; | ||
import { renderFile } from '../utils/ets.js'; | ||
@@ -4,0 +4,0 @@ program |
{ | ||
"name": "embedded-ts", | ||
"version": "0.3.2", | ||
"type": "module", | ||
"version": "0.3.4", | ||
"description": "Embedded TypeScript.", | ||
"license": "MIT", | ||
"bin": { | ||
"ets": "./bin/cli.js" | ||
"author": { | ||
"name": "Leon Si", | ||
"email": "contact@leonzalion.com", | ||
"url": "https://leonzalion.com" | ||
}, | ||
@@ -13,35 +16,36 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/leonzalion/ets#readme", | ||
"author": { | ||
"name": "Leon Si", | ||
"email": "contact@leonzalion.com", | ||
"url": "https://leonzalion.com" | ||
}, | ||
"type": "module", | ||
"exports": { | ||
"import": "./index.js", | ||
"require": "./index.cjs" | ||
"import": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"require": { | ||
"types": "./index.d.cts", | ||
"default": "./index.cjs" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@leonzalion/configs": "^1.2.33", | ||
"@types/lru-cache": "^7.6.1", | ||
"@types/node": "^17.0.31", | ||
"@types/xml-escape": "^1.1.0", | ||
"desm": "^1.2.0", | ||
"eslint-define-config": "^1.4.0", | ||
"execa": "^6.1.0", | ||
"lion-system": "^1.3.25", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.6.4", | ||
"vitest": "^0.10.0" | ||
"bin": { | ||
"ets": "./bin/cli.js" | ||
}, | ||
"homepage": "https://github.com/leonzalion/ets#readme", | ||
"dependencies": { | ||
"change-case": "^4.1.2", | ||
"commander": "^9.2.0", | ||
"esbuild": "^0.14.38", | ||
"commander": "^9.4.1", | ||
"esbuild": "^0.15.11", | ||
"escape-string-regexp": "^5.0.0", | ||
"lru-cache": "^7.9.0", | ||
"lru-cache": "^7.14.0", | ||
"outdent": "^0.8.0", | ||
"xml-escape": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.8.5", | ||
"@types/xml-escape": "^1.1.1", | ||
"desm": "^1.3.0", | ||
"eslint-define-config": "^1.7.0", | ||
"execa": "^6.1.0", | ||
"lionconfig": "^1.8.11", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.8.4", | ||
"vitest": "^0.24.3" | ||
}, | ||
"publishConfig": { | ||
@@ -52,9 +56,9 @@ "directory": "dist" | ||
"release": "lionp", | ||
"build": "node-ts ./scripts/build.ts", | ||
"start": "node-ts ./src/index.ts", | ||
"build": "node-ts ./scripts/build.js", | ||
"start": "node-ts ./src/index.js", | ||
"test": "vitest run", | ||
"lint": "eslint --cache --fix .", | ||
"prettier": "prettier --write .", | ||
"tc": "tsc --noEmit" | ||
"typecheck": "tsc --noEmit" | ||
} | ||
} |
@@ -30,3 +30,3 @@ export declare type RenderFileCallback<T> = (err: Error | null, str: string) => T; | ||
export declare type EscapeCallback = (markup?: any) => string; | ||
declare type RethrowProps = { | ||
interface RethrowProps { | ||
error: Error; | ||
@@ -37,3 +37,3 @@ source: string; | ||
escape: EscapeCallback; | ||
}; | ||
} | ||
/** | ||
@@ -40,0 +40,0 @@ * This type of callback is used when `Options.compileDebug` |
@@ -1,2 +0,2 @@ | ||
import type { ETSOptions, TemplateFunction } from '../types.js'; | ||
import type { ETSOptions, TemplateFunction } from '~/types.js'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Get the path to the included file from the parent file path and the |
@@ -143,3 +143,3 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
const fs = await import('node:fs'); | ||
template = await fs.promises.readFile(filename, 'utf-8'); | ||
template = await fs.promises.readFile(filename, 'utf8'); | ||
template = template.replace(BOM, ''); | ||
@@ -174,10 +174,8 @@ } | ||
const includerResult = await options.includer(filePath, opts.filename); | ||
if (includerResult) { | ||
if (includerResult.filename) { | ||
opts.filename = includerResult.filename; | ||
} | ||
if (includerResult.template) { | ||
return handleCache(opts, includerResult.template); | ||
} | ||
if (includerResult.filename) { | ||
opts.filename = includerResult.filename; | ||
} | ||
if (includerResult.template) { | ||
return handleCache(opts, includerResult.template); | ||
} | ||
} | ||
@@ -207,3 +205,3 @@ const templateRenderFunction = await handleCache(opts); | ||
error.message = outdent ` | ||
${filename ?? 'ets'}:${lineno} | ||
${filename === '' ? 'ets' : filename}:${lineno} | ||
${context} | ||
@@ -354,6 +352,4 @@ | ||
this.generateSource(); | ||
if (options.importResolver !== undefined) { | ||
// Transform all dynamic imports from `import(...)` to `import(__importResolver(...))` | ||
this.source = this.source.replace(/import\(([\s\S]*?)\)/g, 'import(__importResolver($1))'); | ||
} | ||
// Transform all dynamic imports from `import(...)` to `import(__importResolver(...))` | ||
this.source = this.source.replace(/import\(([\s\S]*?)\)/g, 'import(__importResolver($1))'); | ||
let code; | ||
@@ -360,0 +356,0 @@ if (options.transform === undefined) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75128
9
1822
1
+ Added@esbuild/android-arm@0.15.18(transitive)
+ Added@esbuild/linux-loong64@0.15.18(transitive)
+ Addedesbuild@0.15.18(transitive)
+ Addedesbuild-android-64@0.15.18(transitive)
+ Addedesbuild-android-arm64@0.15.18(transitive)
+ Addedesbuild-darwin-64@0.15.18(transitive)
+ Addedesbuild-darwin-arm64@0.15.18(transitive)
+ Addedesbuild-freebsd-64@0.15.18(transitive)
+ Addedesbuild-freebsd-arm64@0.15.18(transitive)
+ Addedesbuild-linux-32@0.15.18(transitive)
+ Addedesbuild-linux-64@0.15.18(transitive)
+ Addedesbuild-linux-arm@0.15.18(transitive)
+ Addedesbuild-linux-arm64@0.15.18(transitive)
+ Addedesbuild-linux-mips64le@0.15.18(transitive)
+ Addedesbuild-linux-ppc64le@0.15.18(transitive)
+ Addedesbuild-linux-riscv64@0.15.18(transitive)
+ Addedesbuild-linux-s390x@0.15.18(transitive)
+ Addedesbuild-netbsd-64@0.15.18(transitive)
+ Addedesbuild-openbsd-64@0.15.18(transitive)
+ Addedesbuild-sunos-64@0.15.18(transitive)
+ Addedesbuild-windows-32@0.15.18(transitive)
+ Addedesbuild-windows-64@0.15.18(transitive)
+ Addedesbuild-windows-arm64@0.15.18(transitive)
- Removed@esbuild/linux-loong64@0.14.54(transitive)
- Removedesbuild@0.14.54(transitive)
- Removedesbuild-android-64@0.14.54(transitive)
- Removedesbuild-android-arm64@0.14.54(transitive)
- Removedesbuild-darwin-64@0.14.54(transitive)
- Removedesbuild-darwin-arm64@0.14.54(transitive)
- Removedesbuild-freebsd-64@0.14.54(transitive)
- Removedesbuild-freebsd-arm64@0.14.54(transitive)
- Removedesbuild-linux-32@0.14.54(transitive)
- Removedesbuild-linux-64@0.14.54(transitive)
- Removedesbuild-linux-arm@0.14.54(transitive)
- Removedesbuild-linux-arm64@0.14.54(transitive)
- Removedesbuild-linux-mips64le@0.14.54(transitive)
- Removedesbuild-linux-ppc64le@0.14.54(transitive)
- Removedesbuild-linux-riscv64@0.14.54(transitive)
- Removedesbuild-linux-s390x@0.14.54(transitive)
- Removedesbuild-netbsd-64@0.14.54(transitive)
- Removedesbuild-openbsd-64@0.14.54(transitive)
- Removedesbuild-sunos-64@0.14.54(transitive)
- Removedesbuild-windows-32@0.14.54(transitive)
- Removedesbuild-windows-64@0.14.54(transitive)
- Removedesbuild-windows-arm64@0.14.54(transitive)
Updatedcommander@^9.4.1
Updatedesbuild@^0.15.11
Updatedlru-cache@^7.14.0