@gjsify/esbuild-plugin-gjsify 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/esm/index.mjs +669 -6264
- package/dist/shims/console-gjs.js +51 -0
- package/dist/types/app/index.d.ts +0 -1
- package/dist/types/types/app.d.ts +1 -1
- package/dist/types/types/plugin-options.d.ts +7 -0
- package/dist/types/utils/alias.d.ts +0 -3
- package/dist/types/utils/entry-points.d.ts +1 -1
- package/dist/types/utils/extension.d.ts +1 -8
- package/dist/types/utils/merge.d.ts +2 -0
- package/dist/types/utils/patch-to-common-js.d.ts +12 -0
- package/esbuild.mjs +20 -35
- package/package.json +19 -15
- package/src/app/browser.ts +2 -4
- package/src/app/gjs.ts +28 -8
- package/src/app/index.ts +0 -1
- package/src/app/node.ts +14 -5
- package/src/lib/lib.ts +1 -1
- package/src/plugin.ts +3 -6
- package/src/shims/console-gjs.ts +19 -0
- package/src/types/app.ts +1 -1
- package/src/types/plugin-options.ts +8 -1
- package/src/utils/alias.ts +1 -14
- package/src/utils/extension.ts +1 -1
- package/src/utils/merge.ts +22 -0
- package/src/utils/patch-to-common-js.ts +45 -0
- package/tsconfig.json +17 -7
- package/dist/cjs/index.cjs +0 -11751
- package/dist/types/alias-plugin.d.ts +0 -2
- package/dist/types/app/deno.d.ts +0 -3
- package/src/app/deno.ts +0 -63
- package/src/lodash.d.ts +0 -46
package/dist/types/app/deno.d.ts
DELETED
package/src/app/deno.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { aliasPlugin } from '@gjsify/esbuild-plugin-alias';
|
|
2
|
-
import { denoPlugin } from '@gjsify/esbuild-plugin-deno-loader';
|
|
3
|
-
import * as deepkitPlugin from '@gjsify/esbuild-plugin-deepkit';
|
|
4
|
-
import { merge } from "lodash";
|
|
5
|
-
|
|
6
|
-
// Types
|
|
7
|
-
import type { PluginBuild, BuildOptions } from "esbuild";
|
|
8
|
-
import type { PluginOptions } from '../types/plugin-options.js';
|
|
9
|
-
import { getAliasesForDeno, globToEntryPoints } from "../utils/index.js";
|
|
10
|
-
|
|
11
|
-
export const setupForDeno = async (build: PluginBuild, pluginOptions: PluginOptions) => {
|
|
12
|
-
|
|
13
|
-
const external = [];
|
|
14
|
-
const format = pluginOptions.format || 'esm';
|
|
15
|
-
|
|
16
|
-
if(format !== 'esm') throw new TypeError('Only ESM format is supported for Deno');
|
|
17
|
-
|
|
18
|
-
pluginOptions.aliases ||= {};
|
|
19
|
-
pluginOptions.exclude ||= [];
|
|
20
|
-
|
|
21
|
-
// Set default options
|
|
22
|
-
const esbuildOptions: BuildOptions = {
|
|
23
|
-
format, // Only 'esm' is supported for Deno
|
|
24
|
-
bundle: true,
|
|
25
|
-
minify: false,
|
|
26
|
-
sourcemap: false,
|
|
27
|
-
treeShaking: true,
|
|
28
|
-
preserveSymlinks: false, // false means follow symlinks
|
|
29
|
-
target: [ "esnext" ],
|
|
30
|
-
platform: "neutral",
|
|
31
|
-
mainFields: ['module', 'main'],
|
|
32
|
-
conditions: ['module','import'],
|
|
33
|
-
external,
|
|
34
|
-
loader: {
|
|
35
|
-
'.ts': 'ts',
|
|
36
|
-
'.mts': 'ts',
|
|
37
|
-
'.cts': 'ts',
|
|
38
|
-
'.tsx': 'ts',
|
|
39
|
-
'.mtsx': 'ts',
|
|
40
|
-
'.ctsx': 'ts',
|
|
41
|
-
'.mjs': 'ts',
|
|
42
|
-
'.cjs': 'ts',
|
|
43
|
-
'.js': 'ts',
|
|
44
|
-
},
|
|
45
|
-
inject: [],
|
|
46
|
-
define: {
|
|
47
|
-
global: 'globalThis',
|
|
48
|
-
window: 'globalThis',
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
merge(build.initialOptions, esbuildOptions);
|
|
53
|
-
|
|
54
|
-
build.initialOptions.entryPoints = await globToEntryPoints(build.initialOptions.entryPoints, pluginOptions.exclude)
|
|
55
|
-
|
|
56
|
-
const aliases = {...getAliasesForDeno({external}), ...pluginOptions.aliases};
|
|
57
|
-
|
|
58
|
-
if(pluginOptions.debug) console.debug("initialOptions", build.initialOptions);
|
|
59
|
-
|
|
60
|
-
await aliasPlugin(aliases).setup(build);
|
|
61
|
-
await denoPlugin({reflection: pluginOptions.reflection}).setup(build);
|
|
62
|
-
await deepkitPlugin.deepkitPlugin({reflection: pluginOptions.reflection}).setup(build);
|
|
63
|
-
}
|
package/src/lodash.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
declare module 'lodash' {
|
|
2
|
-
/**
|
|
3
|
-
* Recursively merges own and inherited enumerable properties of source
|
|
4
|
-
* objects into the destination object, skipping source properties that resolve
|
|
5
|
-
* to `undefined`. Array and plain object properties are merged recursively.
|
|
6
|
-
* Other objects and value types are overridden by assignment. Source objects
|
|
7
|
-
* are applied from left to right. Subsequent sources overwrite property
|
|
8
|
-
* assignments of previous sources.
|
|
9
|
-
*
|
|
10
|
-
* **Note:** This method mutates `object`.
|
|
11
|
-
*
|
|
12
|
-
* @category Object
|
|
13
|
-
* @param object The destination object.
|
|
14
|
-
* @param [sources] The source objects.
|
|
15
|
-
* @returns Returns `object`.
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* var users = {
|
|
19
|
-
* 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* var ages = {
|
|
23
|
-
* 'data': [{ 'age': 36 }, { 'age': 40 }]
|
|
24
|
-
* };
|
|
25
|
-
*
|
|
26
|
-
* _.merge(users, ages);
|
|
27
|
-
* // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
|
|
28
|
-
*/
|
|
29
|
-
function merge<TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
|
|
30
|
-
/**
|
|
31
|
-
* @see _.merge
|
|
32
|
-
*/
|
|
33
|
-
function merge<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): TObject & TSource1 & TSource2;
|
|
34
|
-
/**
|
|
35
|
-
* @see _.merge
|
|
36
|
-
*/
|
|
37
|
-
function merge<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TObject & TSource1 & TSource2 & TSource3;
|
|
38
|
-
/**
|
|
39
|
-
* @see _.merge
|
|
40
|
-
*/
|
|
41
|
-
function merge<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): TObject & TSource1 & TSource2 & TSource3 & TSource4;
|
|
42
|
-
/**
|
|
43
|
-
* @see _.merge
|
|
44
|
-
*/
|
|
45
|
-
function merge(object: any, ...otherArgs: any[]): any;
|
|
46
|
-
}
|