Comparing version 1.1.0 to 1.2.0
@@ -90,6 +90,8 @@ interface CodegenOptions { | ||
* | ||
* Values are not escaped or quoted. | ||
* | ||
* @example | ||
* | ||
* ```js | ||
* genObjectFromValues({ foo: "bar", test: '() => import("pkg")' }) | ||
* genObjectFromRaw({ foo: "bar", test: '() => import("pkg")' }) | ||
* // ~> `{ foo: bar, test: () => import("pkg") }` | ||
@@ -104,2 +106,4 @@ * ``` | ||
* | ||
* Values are escaped and quoted if necessary. | ||
* | ||
* @example | ||
@@ -118,2 +122,4 @@ * | ||
* | ||
* Values are not escaped or quoted. | ||
* | ||
* @example | ||
@@ -132,2 +138,4 @@ * | ||
* | ||
* Values are not escaped or quoted. | ||
* | ||
* @group serialization | ||
@@ -194,2 +202,15 @@ */ | ||
export { type CodegenOptions, type DynamicImportOptions, type ESMCodeGenOptions, type ESMExport, type ESMImport, type GenInterfaceOptions, type GenObjectOptions, type TypeObject, escapeString, genArrayFromRaw, genAugmentation, genDynamicImport, genExport, genImport, genInlineTypeImport, genInterface, genObjectFromRaw, genObjectFromRawEntries, genObjectFromValues, genSafeVariableName, genString, genTypeExport, genTypeImport, genTypeObject }; | ||
/** | ||
* Wrap an array of strings in delimiters. | ||
* | ||
* @group utils | ||
*/ | ||
declare function wrapInDelimiters(lines: string[], indent?: string, delimiters?: string, withComma?: boolean): string; | ||
/** | ||
* Generate a safe javascript variable name for an object key. | ||
* | ||
* @group utils | ||
*/ | ||
declare function genObjectKey(key: string): string; | ||
export { type CodegenOptions, type DynamicImportOptions, type ESMCodeGenOptions, type ESMExport, type ESMImport, type GenInterfaceOptions, type GenObjectOptions, type TypeObject, escapeString, genArrayFromRaw, genAugmentation, genDynamicImport, genExport, genImport, genInlineTypeImport, genInterface, genObjectFromRaw, genObjectFromRawEntries, genObjectFromValues, genObjectKey, genSafeVariableName, genString, genTypeExport, genTypeImport, genTypeObject, wrapInDelimiters }; |
{ | ||
"name": "knitwork", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Utilities to generate JavaScript code.", | ||
@@ -25,4 +25,4 @@ "repository": "unjs/knitwork", | ||
"dev": "vitest dev --coverage", | ||
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test", | ||
"lint:fix": "automd && eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w", | ||
"lint": "eslint --cache . && prettier -c src test", | ||
"lint:fix": "automd && eslint --cache . --fix && prettier -c src test -w", | ||
"prepack": "pnpm run build", | ||
@@ -33,14 +33,14 @@ "release": "pnpm test && changelogen --release && npm publish && git push --follow-tags", | ||
"devDependencies": { | ||
"@vitest/coverage-v8": "^1.4.0", | ||
"automd": "^0.3.7", | ||
"changelogen": "^0.5.5", | ||
"esbuild": "^0.20.2", | ||
"eslint": "^8.57.0", | ||
"eslint-config-unjs": "^0.2.1", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.4.3", | ||
"unbuild": "^2.0.0", | ||
"vitest": "^1.4.0" | ||
"@vitest/coverage-v8": "^2.1.8", | ||
"automd": "^0.3.12", | ||
"changelogen": "^0.5.7", | ||
"esbuild": "^0.24.0", | ||
"eslint": "^9.17.0", | ||
"eslint-config-unjs": "^0.4.2", | ||
"prettier": "^3.4.2", | ||
"typescript": "^5.7.2", | ||
"unbuild": "^3.0.1", | ||
"vitest": "^2.1.8" | ||
}, | ||
"packageManager": "pnpm@8.15.5" | ||
"packageManager": "pnpm@9.15.0" | ||
} |
@@ -6,3 +6,3 @@ # 🧶 knitwork | ||
[![npm version](https://img.shields.io/npm/v/knitwork?color=yellow)](https://npmjs.com/package/knitwork) | ||
[![npm downloads](https://img.shields.io/npm/dm/knitwork?color=yellow)](https://npmjs.com/package/knitwork) | ||
[![npm downloads](https://img.shields.io/npm/dm/knitwork?color=yellow)](https://npm.chart.dev/knitwork) | ||
[![codecov](https://img.shields.io/codecov/c/gh/unjs/knitwork?color=yellow)](https://codecov.io/gh/unjs/knitwork) | ||
@@ -33,2 +33,5 @@ | ||
bun install knitwork | ||
# deno | ||
deno install knitwork | ||
``` | ||
@@ -40,3 +43,3 @@ | ||
**ESM** (Node.js, Bun) | ||
**ESM** (Node.js, Bun, Deno) | ||
@@ -119,2 +122,4 @@ ```js | ||
Values are not escaped or quoted. | ||
**Example:** | ||
@@ -131,6 +136,8 @@ | ||
Values are not escaped or quoted. | ||
**Example:** | ||
```js | ||
genObjectFromValues({ foo: "bar", test: '() => import("pkg")' }) | ||
genObjectFromRaw({ foo: "bar", test: '() => import("pkg")' }) | ||
// ~> `{ foo: bar, test: () => import("pkg") }` | ||
@@ -143,2 +150,4 @@ ``` | ||
Values are not escaped or quoted. | ||
### `genObjectFromValues(obj, indent, options)` | ||
@@ -148,2 +157,4 @@ | ||
Values are escaped and quoted if necessary. | ||
**Example:** | ||
@@ -192,2 +203,12 @@ | ||
## Utils | ||
### `genObjectKey(key)` | ||
Generate a safe javascript variable name for an object key. | ||
### `wrapInDelimiters(lines, indent, delimiters, withComma)` | ||
Wrap an array of strings in delimiters. | ||
<!-- /automd --> | ||
@@ -194,0 +215,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
39311
707
241