@confirmdev/listalyze 0.2.1
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/PUBLISH.md +71 -0
- package/README.md +87 -0
- package/dist/index.js +7911 -0
- package/dist/vendor/license-nag/license_nag.cjs +215 -0
- package/dist/vendor/license-nag/license_nag_bg.wasm +0 -0
- package/package.json +38 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/* @ts-self-types="./license_nag.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WASM entry point. `token` is `Option<String>` (pass `null`/`undefined` for
|
|
5
|
+
* no token); returns the [`Evaluation`] struct as a plain JS object.
|
|
6
|
+
* @param {string | null | undefined} token
|
|
7
|
+
* @param {bigint} now_unix_secs
|
|
8
|
+
* @returns {any}
|
|
9
|
+
*/
|
|
10
|
+
function evaluate(token, now_unix_secs) {
|
|
11
|
+
var ptr0 = isLikeNone(token) ? 0 : passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12
|
+
var len0 = WASM_VECTOR_LEN;
|
|
13
|
+
const ret = wasm.evaluate(ptr0, len0, now_unix_secs);
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
exports.evaluate = evaluate;
|
|
17
|
+
function __wbg_get_imports() {
|
|
18
|
+
const import0 = {
|
|
19
|
+
__proto__: null,
|
|
20
|
+
__wbg___wbindgen_debug_string_8a447059637473e2: function(arg0, arg1) {
|
|
21
|
+
const ret = debugString(arg1);
|
|
22
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
23
|
+
const len1 = WASM_VECTOR_LEN;
|
|
24
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
25
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
26
|
+
},
|
|
27
|
+
__wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
|
|
28
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
29
|
+
},
|
|
30
|
+
__wbg_new_2e117a478906f062: function() {
|
|
31
|
+
const ret = new Object();
|
|
32
|
+
return ret;
|
|
33
|
+
},
|
|
34
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
35
|
+
arg0[arg1] = arg2;
|
|
36
|
+
},
|
|
37
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
38
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
39
|
+
const ret = arg0;
|
|
40
|
+
return ret;
|
|
41
|
+
},
|
|
42
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
43
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
44
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
45
|
+
return ret;
|
|
46
|
+
},
|
|
47
|
+
__wbindgen_init_externref_table: function() {
|
|
48
|
+
const table = wasm.__wbindgen_externrefs;
|
|
49
|
+
const offset = table.grow(4);
|
|
50
|
+
table.set(0, undefined);
|
|
51
|
+
table.set(offset + 0, undefined);
|
|
52
|
+
table.set(offset + 1, null);
|
|
53
|
+
table.set(offset + 2, true);
|
|
54
|
+
table.set(offset + 3, false);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
__proto__: null,
|
|
59
|
+
"./license_nag_bg.js": import0,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function debugString(val) {
|
|
64
|
+
// primitive types
|
|
65
|
+
const type = typeof val;
|
|
66
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
67
|
+
return `${val}`;
|
|
68
|
+
}
|
|
69
|
+
if (type == 'string') {
|
|
70
|
+
return `"${val}"`;
|
|
71
|
+
}
|
|
72
|
+
if (type == 'symbol') {
|
|
73
|
+
const description = val.description;
|
|
74
|
+
if (description == null) {
|
|
75
|
+
return 'Symbol';
|
|
76
|
+
} else {
|
|
77
|
+
return `Symbol(${description})`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (type == 'function') {
|
|
81
|
+
const name = val.name;
|
|
82
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
83
|
+
return `Function(${name})`;
|
|
84
|
+
} else {
|
|
85
|
+
return 'Function';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// objects
|
|
89
|
+
if (Array.isArray(val)) {
|
|
90
|
+
const length = val.length;
|
|
91
|
+
let debug = '[';
|
|
92
|
+
if (length > 0) {
|
|
93
|
+
debug += debugString(val[0]);
|
|
94
|
+
}
|
|
95
|
+
for(let i = 1; i < length; i++) {
|
|
96
|
+
debug += ', ' + debugString(val[i]);
|
|
97
|
+
}
|
|
98
|
+
debug += ']';
|
|
99
|
+
return debug;
|
|
100
|
+
}
|
|
101
|
+
// Test for built-in
|
|
102
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
103
|
+
let className;
|
|
104
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
105
|
+
className = builtInMatches[1];
|
|
106
|
+
} else {
|
|
107
|
+
// Failed to match the standard '[object ClassName]'
|
|
108
|
+
return toString.call(val);
|
|
109
|
+
}
|
|
110
|
+
if (className == 'Object') {
|
|
111
|
+
// we're a user defined class or Object
|
|
112
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
113
|
+
// easier than looping through ownProperties of `val`.
|
|
114
|
+
try {
|
|
115
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
116
|
+
} catch (_) {
|
|
117
|
+
return 'Object';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// errors
|
|
121
|
+
if (val instanceof Error) {
|
|
122
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
123
|
+
}
|
|
124
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
125
|
+
return className;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
let cachedDataViewMemory0 = null;
|
|
129
|
+
function getDataViewMemory0() {
|
|
130
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
131
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
132
|
+
}
|
|
133
|
+
return cachedDataViewMemory0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getStringFromWasm0(ptr, len) {
|
|
137
|
+
return decodeText(ptr >>> 0, len);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
let cachedUint8ArrayMemory0 = null;
|
|
141
|
+
function getUint8ArrayMemory0() {
|
|
142
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
143
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
144
|
+
}
|
|
145
|
+
return cachedUint8ArrayMemory0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function isLikeNone(x) {
|
|
149
|
+
return x === undefined || x === null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
153
|
+
if (realloc === undefined) {
|
|
154
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
155
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
156
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
157
|
+
WASM_VECTOR_LEN = buf.length;
|
|
158
|
+
return ptr;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
let len = arg.length;
|
|
162
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
163
|
+
|
|
164
|
+
const mem = getUint8ArrayMemory0();
|
|
165
|
+
|
|
166
|
+
let offset = 0;
|
|
167
|
+
|
|
168
|
+
for (; offset < len; offset++) {
|
|
169
|
+
const code = arg.charCodeAt(offset);
|
|
170
|
+
if (code > 0x7F) break;
|
|
171
|
+
mem[ptr + offset] = code;
|
|
172
|
+
}
|
|
173
|
+
if (offset !== len) {
|
|
174
|
+
if (offset !== 0) {
|
|
175
|
+
arg = arg.slice(offset);
|
|
176
|
+
}
|
|
177
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
178
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
179
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
180
|
+
|
|
181
|
+
offset += ret.written;
|
|
182
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
WASM_VECTOR_LEN = offset;
|
|
186
|
+
return ptr;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
190
|
+
cachedTextDecoder.decode();
|
|
191
|
+
function decodeText(ptr, len) {
|
|
192
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const cachedTextEncoder = new TextEncoder();
|
|
196
|
+
|
|
197
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
198
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
199
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
200
|
+
view.set(buf);
|
|
201
|
+
return {
|
|
202
|
+
read: arg.length,
|
|
203
|
+
written: buf.length
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let WASM_VECTOR_LEN = 0;
|
|
209
|
+
|
|
210
|
+
const wasmPath = `${__dirname}/license_nag_bg.wasm`;
|
|
211
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
212
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
213
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
214
|
+
let wasm = wasmInstance.exports;
|
|
215
|
+
wasm.__wbindgen_start();
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@confirmdev/listalyze",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"bin": {
|
|
7
|
+
"listalyze": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"PUBLISH.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/ConfirmDev/listalyze.git",
|
|
23
|
+
"directory": "apps/cli"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
|
+
"sync-vendor": "mkdir -p vendor/license-nag && cp ../../packages/license-nag/pkg/license_nag.cjs ../../packages/license-nag/pkg/license_nag_bg.wasm ../../packages/license-nag/pkg/license_nag.d.ts vendor/license-nag/",
|
|
28
|
+
"bundle": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --format=esm --target=node20 --packages=bundle --banner:js=\"#!/usr/bin/env node\" --outfile=dist/index.js && chmod +x dist/index.js && mkdir -p dist/vendor/license-nag && cp vendor/license-nag/license_nag.cjs vendor/license-nag/license_nag_bg.wasm dist/vendor/license-nag/",
|
|
29
|
+
"build": "pnpm sync-vendor && pnpm typecheck && pnpm bundle",
|
|
30
|
+
"test": "vitest run"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"esbuild": "^0.25.0",
|
|
34
|
+
"typescript": "^5.5.0",
|
|
35
|
+
"vitest": "^2.0.0"
|
|
36
|
+
},
|
|
37
|
+
"description": "Local-first list & text power tool — sort, clean, dedupe, regex from your terminal. Free; Pro unlocks more."
|
|
38
|
+
}
|