forked from divyenduz/plv8ify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use inversify for DI, clean up code (divyenduz#16)
* chore: run it for trackfootball but ignore the sources * refactor: introduce inversify for bundler aka esbuild * refactor: remove unused dep to bundler * refactor: rename build to bundle * refactor: add a simple example and a start_proc example * refactor: edit start_proc example to include multiple functions * refactor: introduce inversify to ts compiler aka ts-morph * chores: refactor, change public api * chores: refactor, remove a bunch of fixmes * refactor: make bundler independent of plv8 mode * refactor: fix tests * refactor: clean up * refactor: clean up * refactor: fix tests * refactor: move start_proc and mode code to plv8ify cli * chore: comments * fix: readme, actual args sync * fix: use tsconfig.build.json to have tests be ts checked in dev but not included in prod * fix: types check * ci: run on push to main
- Loading branch information
Showing
42 changed files
with
1,457 additions
and
1,223 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ node_modules | |
/plv8ify-dist/ | ||
dist/ | ||
|
||
.nyc_output | ||
.nyc_output | ||
examples/trackfootball |
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,7 @@ | ||
export function hello() { | ||
return 'world' | ||
} | ||
|
||
export function world() { | ||
return 'hello' | ||
} |
6 changes: 6 additions & 0 deletions
6
examples/hello-start_proc/plv8ify-dist/plv8ify_hello.plv8.sql
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,6 @@ | ||
DROP FUNCTION IF EXISTS plv8ify_hello(); | ||
CREATE OR REPLACE FUNCTION plv8ify_hello() RETURNS text AS $plv8ify$ | ||
|
||
return plv8ify.hello() | ||
|
||
$plv8ify$ LANGUAGE plv8 IMMUTABLE STRICT; |
42 changes: 42 additions & 0 deletions
42
examples/hello-start_proc/plv8ify-dist/plv8ify_init.plv8.sql
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,42 @@ | ||
DROP FUNCTION IF EXISTS plv8ify_init(); | ||
CREATE OR REPLACE FUNCTION plv8ify_init() RETURNS VOID AS $$ | ||
this.plv8ify = (() => { | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __reExport = (target, module, copyDefault, desc) => { | ||
if (module && typeof module === "object" || typeof module === "function") { | ||
for (let key of __getOwnPropNames(module)) | ||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) | ||
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable }); | ||
} | ||
return target; | ||
}; | ||
var __toCommonJS = /* @__PURE__ */ ((cache) => { | ||
return (module, temp) => { | ||
return cache && cache.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache && cache.set(module, temp), temp); | ||
}; | ||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); | ||
|
||
// examples/hello-start_proc/input.ts | ||
var input_exports = {}; | ||
__export(input_exports, { | ||
hello: () => hello, | ||
world: () => world | ||
}); | ||
function hello() { | ||
return "world"; | ||
} | ||
function world() { | ||
return "hello"; | ||
} | ||
return __toCommonJS(input_exports); | ||
})(); | ||
|
||
$$ LANGUAGE plv8 IMMUTABLE STRICT; |
3 changes: 3 additions & 0 deletions
3
examples/hello-start_proc/plv8ify-dist/plv8ify_start.plv8.sql
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 @@ | ||
|
||
SET plv8.start_proc = plv8ify_init; | ||
SELECT plv8_reset(); |
6 changes: 6 additions & 0 deletions
6
examples/hello-start_proc/plv8ify-dist/plv8ify_world.plv8.sql
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,6 @@ | ||
DROP FUNCTION IF EXISTS plv8ify_world(); | ||
CREATE OR REPLACE FUNCTION plv8ify_world() RETURNS text AS $plv8ify$ | ||
|
||
return plv8ify.world() | ||
|
||
$plv8ify$ LANGUAGE plv8 IMMUTABLE STRICT; |
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 @@ | ||
export function hello() { | ||
return 'world' | ||
} |
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,40 @@ | ||
DROP FUNCTION IF EXISTS plv8ify_hello(); | ||
CREATE OR REPLACE FUNCTION plv8ify_hello() RETURNS text AS $plv8ify$ | ||
var plv8ify = (() => { | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __reExport = (target, module, copyDefault, desc) => { | ||
if (module && typeof module === "object" || typeof module === "function") { | ||
for (let key of __getOwnPropNames(module)) | ||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) | ||
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable }); | ||
} | ||
return target; | ||
}; | ||
var __toCommonJS = /* @__PURE__ */ ((cache) => { | ||
return (module, temp) => { | ||
return cache && cache.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache && cache.set(module, temp), temp); | ||
}; | ||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); | ||
|
||
// examples/hello/input.ts | ||
var input_exports = {}; | ||
__export(input_exports, { | ||
hello: () => hello | ||
}); | ||
function hello() { | ||
return "world"; | ||
} | ||
return __toCommonJS(input_exports); | ||
})(); | ||
|
||
return plv8ify.hello() | ||
|
||
$plv8ify$ LANGUAGE plv8 IMMUTABLE STRICT; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.