-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding error panic hook for better debugging * Added functionality to check if a string contains a pattern * Support both cjs require and es6 imports for jsonnet library
- Loading branch information
Showing
19 changed files
with
519 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
{ | ||
"name": "@arakoodev/jsonnet", | ||
"version": "0.2.0", | ||
"main": "src/index.js", | ||
"type": "module", | ||
"types": "src/index.d.ts" | ||
"exports":{ | ||
"import":{ | ||
"default":"./src/index.mjs", | ||
"types":"./src/index.d.mts" | ||
}, | ||
"require":{ | ||
"default":"./src/index.js", | ||
"types":"./src/index.d.ts" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import fs from "fs"; | ||
// import fs from "fs"; | ||
const fs = require("fs"); | ||
|
||
export function read_file(path) { | ||
function read_file(path) { | ||
return fs.readFileSync(path, { encoding: "utf8" }); | ||
} | ||
|
||
module.exports = { read_file } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
declare class Jsonnet { | ||
constructor(); | ||
evaluateSnippet(snippet: string): string; | ||
destroy(): void; | ||
extString(key: string, value: string): this; | ||
evaluateFile(filename: string): string; | ||
javascriptCallback(name: string, func: Function): this; | ||
} | ||
|
||
export default Jsonnet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
import Jsonnet from "./jsonnet.js"; | ||
|
||
export default Jsonnet; | ||
const Jsonnet = require("./jsonnet.js") | ||
module.exports = Jsonnet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Jsonnet from "./jsonnet.js"; | ||
|
||
export default Jsonnet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* @returns {number} | ||
*/ | ||
* @returns {number} | ||
*/ | ||
export function jsonnet_make(): number; | ||
/** | ||
* @param {number} vm | ||
*/ | ||
* @param {number} vm | ||
*/ | ||
export function jsonnet_destroy(vm: number): void; | ||
/** | ||
* @param {number} vm | ||
* @param {string} filename | ||
* @param {string} snippet | ||
* @returns {string} | ||
*/ | ||
* @param {number} vm | ||
* @param {string} filename | ||
* @param {string} snippet | ||
* @returns {string} | ||
*/ | ||
export function jsonnet_evaluate_snippet(vm: number, filename: string, snippet: string): string; | ||
/** | ||
* @param {number} vm | ||
* @param {string} filename | ||
* @returns {string} | ||
*/ | ||
* @param {number} vm | ||
* @param {string} filename | ||
* @returns {string} | ||
*/ | ||
export function jsonnet_evaluate_file(vm: number, filename: string): string; | ||
/** | ||
* @param {number} vm | ||
* @param {string} key | ||
* @param {string} value | ||
*/ | ||
* @param {number} vm | ||
* @param {string} key | ||
* @param {string} value | ||
*/ | ||
export function ext_string(vm: number, key: string, value: string): void; | ||
/** | ||
* @param {string} name | ||
* @returns {Function | undefined} | ||
*/ | ||
* @param {string} name | ||
* @returns {Function | undefined} | ||
*/ | ||
export function get_func(name: string): Function | undefined; | ||
/** | ||
* @param {string} name | ||
* @param {Function} func | ||
*/ | ||
* @param {string} name | ||
* @param {Function} func | ||
*/ | ||
export function set_func(name: string, func: Function): void; | ||
/** | ||
* @param {number} vm | ||
* @param {string} name | ||
* @param {number} args_num | ||
*/ | ||
* @param {number} vm | ||
* @param {string} name | ||
* @param {number} args_num | ||
*/ | ||
export function register_native_callback(vm: number, name: string, args_num: number): void; |
Oops, something went wrong.