pythonlib 0.1.0 → 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/LICENSE +21 -0
- package/README.md +41 -138
- package/dist/{chunk-P3SGIF72.js → chunk-4KYJT3DR.js} +8 -6
- package/dist/chunk-4KYJT3DR.js.map +1 -0
- package/dist/{chunk-3CSEXTA7.js → chunk-4QG3772L.js} +53 -53
- package/dist/chunk-4QG3772L.js.map +1 -0
- package/dist/{chunk-IVYYI2VR.js → chunk-6POEDI34.js} +1 -1
- package/dist/chunk-6POEDI34.js.map +1 -0
- package/dist/{chunk-UFMTN4T4.js → chunk-6ZAJ37MR.js} +6 -5
- package/dist/chunk-6ZAJ37MR.js.map +1 -0
- package/dist/{chunk-V63LKSA3.js → chunk-7TH4FCVQ.js} +24 -24
- package/dist/chunk-7TH4FCVQ.js.map +1 -0
- package/dist/{chunk-TJFGYXBJ.js → chunk-CXKGPD5D.js} +64 -61
- package/dist/chunk-CXKGPD5D.js.map +1 -0
- package/dist/{chunk-OMQNGE6T.js → chunk-EE7SK2GV.js} +33 -27
- package/dist/chunk-EE7SK2GV.js.map +1 -0
- package/dist/{chunk-WAONBJE5.js → chunk-H76SKASU.js} +36 -36
- package/dist/chunk-H76SKASU.js.map +1 -0
- package/dist/{chunk-TOI6IG3T.js → chunk-HQ42WNKZ.js} +43 -16
- package/dist/chunk-HQ42WNKZ.js.map +1 -0
- package/dist/{chunk-HA5Y7PKO.js → chunk-LWO6BIAD.js} +36 -35
- package/dist/chunk-LWO6BIAD.js.map +1 -0
- package/dist/{collections-xN9Gi0TA.d.ts → collections-CJur5Wg-.d.ts} +5 -3
- package/dist/collections.d.ts +1 -1
- package/dist/collections.js +1 -1
- package/dist/{datetime-DRwFAiGV.d.ts → datetime-Bpce8gG2.d.ts} +17 -15
- package/dist/datetime.d.ts +1 -1
- package/dist/datetime.js +1 -1
- package/dist/{functools-St5GqpKG.d.ts → functools-NrsZAqJk.d.ts} +42 -26
- package/dist/functools.d.ts +1 -1
- package/dist/functools.js +19 -17
- package/dist/index.d.ts +56 -158
- package/dist/index.js +47 -137
- package/dist/index.js.map +1 -1
- package/dist/{itertools-Bj8XivI6.d.ts → itertools-Sjl1LB_0.d.ts} +35 -17
- package/dist/itertools.d.ts +1 -1
- package/dist/itertools.js +15 -11
- package/dist/{json-Xpk0kwSd.d.ts → json-DAlvCadU.d.ts} +7 -5
- package/dist/json.d.ts +1 -1
- package/dist/json.js +1 -1
- package/dist/{math-BrT4Aw3E.d.ts → math-DwEGjjQ-.d.ts} +2 -0
- package/dist/math.d.ts +1 -1
- package/dist/math.js +1 -1
- package/dist/{os-FRSJbEUH.d.ts → os-C6Nt7Ijx.d.ts} +45 -42
- package/dist/os.d.ts +1 -1
- package/dist/os.js +23 -23
- package/dist/{random-D5S5iSV3.d.ts → random-BJv_rSpL.d.ts} +24 -22
- package/dist/random.d.ts +1 -1
- package/dist/random.js +21 -21
- package/dist/{re-DSxiURqN.d.ts → re-B1CHCgyr.d.ts} +17 -15
- package/dist/re.d.ts +1 -1
- package/dist/re.js +7 -7
- package/dist/string.d.ts +51 -48
- package/dist/string.js +13 -13
- package/package.json +30 -11
- package/dist/chunk-3CSEXTA7.js.map +0 -1
- package/dist/chunk-HA5Y7PKO.js.map +0 -1
- package/dist/chunk-IVYYI2VR.js.map +0 -1
- package/dist/chunk-OMQNGE6T.js.map +0 -1
- package/dist/chunk-P3SGIF72.js.map +0 -1
- package/dist/chunk-TJFGYXBJ.js.map +0 -1
- package/dist/chunk-TOI6IG3T.js.map +0 -1
- package/dist/chunk-UFMTN4T4.js.map +0 -1
- package/dist/chunk-V63LKSA3.js.map +0 -1
- package/dist/chunk-WAONBJE5.js.map +0 -1
|
@@ -131,7 +131,7 @@ var deque = class {
|
|
|
131
131
|
/**
|
|
132
132
|
* Add element to the left end
|
|
133
133
|
*/
|
|
134
|
-
|
|
134
|
+
appendLeft(x) {
|
|
135
135
|
this.items.unshift(x);
|
|
136
136
|
if (this.maxlen !== null && this.items.length > this.maxlen) {
|
|
137
137
|
this.items.pop();
|
|
@@ -146,7 +146,7 @@ var deque = class {
|
|
|
146
146
|
/**
|
|
147
147
|
* Remove and return element from the left end
|
|
148
148
|
*/
|
|
149
|
-
|
|
149
|
+
popLeft() {
|
|
150
150
|
return this.items.shift();
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
@@ -160,9 +160,9 @@ var deque = class {
|
|
|
160
160
|
/**
|
|
161
161
|
* Extend the left side with elements from iterable
|
|
162
162
|
*/
|
|
163
|
-
|
|
163
|
+
extendLeft(iterable) {
|
|
164
164
|
for (const x of iterable) {
|
|
165
|
-
this.
|
|
165
|
+
this.appendLeft(x);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
@@ -212,4 +212,5 @@ export {
|
|
|
212
212
|
deque,
|
|
213
213
|
collections_exports
|
|
214
214
|
};
|
|
215
|
-
|
|
215
|
+
/* v8 ignore next -- getter properties on Map fail with proxy receiver @preserve */
|
|
216
|
+
//# sourceMappingURL=chunk-6ZAJ37MR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/collections.ts"],"sourcesContent":["/**\n * Python collections module for TypeScript\n *\n * Provides specialized container datatypes.\n *\n * @see {@link https://docs.python.org/3/library/collections.html | Python collections documentation}\n */\n\n/**\n * Counter: a dict subclass for counting hashable objects\n *\n * Elements are stored as keys and their counts are stored as values.\n */\nexport class Counter<T> extends Map<T, number> {\n constructor(iterable?: Iterable<T>) {\n super()\n if (iterable) {\n for (const item of iterable) {\n this.increment(item)\n }\n }\n }\n\n /**\n * Increment the count for a key\n */\n increment(key: T, n: number = 1): void {\n this.set(key, (super.get(key) ?? 0) + n)\n }\n\n /**\n * Get the count for a key (returns 0 for missing keys)\n */\n get(key: T): number {\n return super.get(key) ?? 0\n }\n\n /**\n * List the n most common elements and their counts\n * If n is undefined, list all elements from most common to least\n */\n mostCommon(n?: number): [T, number][] {\n const sorted = [...this.entries()].sort((a, b) => b[1] - a[1])\n return n !== undefined ? sorted.slice(0, n) : sorted\n }\n\n /**\n * Iterate over elements, repeating each as many times as its count\n */\n *elements(): Generator<T> {\n for (const [key, count] of this) {\n for (let i = 0; i < count; i++) {\n yield key\n }\n }\n }\n\n /**\n * Subtract counts from another iterable or Counter\n */\n subtract(iterable: Iterable<T> | Counter<T>): void {\n if (iterable instanceof Counter) {\n for (const [key, count] of iterable) {\n this.set(key, (super.get(key) ?? 0) - count)\n }\n } else {\n for (const item of iterable) {\n this.set(item, (super.get(item) ?? 0) - 1)\n }\n }\n }\n\n /**\n * Add counts from another iterable or Counter\n */\n update(iterable: Iterable<T> | Counter<T>): void {\n if (iterable instanceof Counter) {\n for (const [key, count] of iterable) {\n this.increment(key, count)\n }\n } else {\n for (const item of iterable) {\n this.increment(item)\n }\n }\n }\n\n /**\n * Return total count of all elements\n */\n total(): number {\n let sum = 0\n for (const count of this.values()) {\n sum += count\n }\n return sum\n }\n}\n\n/**\n * defaultdict: a dict that provides default values for missing keys\n *\n * Uses a Proxy to automatically call the factory function for missing keys.\n */\nexport function defaultdict<K, V>(factory: () => V): Map<K, V> & { get(key: K): V } {\n const map = new Map<K, V>()\n return new Proxy(map, {\n get(target, prop, receiver): unknown {\n if (prop === \"get\") {\n return (key: K): V => {\n if (!target.has(key)) {\n const defaultValue = factory()\n target.set(key, defaultValue)\n return defaultValue\n }\n return target.get(key) as V\n }\n }\n const val: unknown = Reflect.get(target, prop, receiver)\n if (typeof val === \"function\") {\n return (val as (...args: unknown[]) => unknown).bind(target)\n }\n /* v8 ignore next -- getter properties on Map fail with proxy receiver @preserve */\n return val\n }\n }) as Map<K, V> & { get(key: K): V }\n}\n\n/**\n * deque: double-ended queue with O(1) append and pop from both ends\n */\nexport class deque<T> {\n private items: T[]\n private maxlen: number | null\n\n constructor(iterable?: Iterable<T>, maxlen?: number) {\n this.items = iterable ? [...iterable] : []\n this.maxlen = maxlen ?? null\n if (this.maxlen !== null && this.items.length > this.maxlen) {\n this.items = this.items.slice(-this.maxlen)\n }\n }\n\n /**\n * Add element to the right end\n */\n append(x: T): void {\n this.items.push(x)\n if (this.maxlen !== null && this.items.length > this.maxlen) {\n this.items.shift()\n }\n }\n\n /**\n * Add element to the left end\n */\n appendLeft(x: T): void {\n this.items.unshift(x)\n if (this.maxlen !== null && this.items.length > this.maxlen) {\n this.items.pop()\n }\n }\n\n /**\n * Remove and return element from the right end\n */\n pop(): T | undefined {\n return this.items.pop()\n }\n\n /**\n * Remove and return element from the left end\n */\n popLeft(): T | undefined {\n return this.items.shift()\n }\n\n /**\n * Extend the right side with elements from iterable\n */\n extend(iterable: Iterable<T>): void {\n for (const x of iterable) {\n this.append(x)\n }\n }\n\n /**\n * Extend the left side with elements from iterable\n */\n extendLeft(iterable: Iterable<T>): void {\n for (const x of iterable) {\n this.appendLeft(x)\n }\n }\n\n /**\n * Rotate the deque n steps to the right (negative n rotates left)\n */\n rotate(n: number = 1): void {\n const len = this.items.length\n if (len === 0) return\n n = n % len\n if (n > 0) {\n // Move last n elements to the front\n const tail = this.items.splice(-n, n)\n this.items.unshift(...tail)\n } else if (n < 0) {\n // Move first -n elements to the end\n const head = this.items.splice(0, -n)\n this.items.push(...head)\n }\n }\n\n /**\n * Remove all elements\n */\n clear(): void {\n this.items = []\n }\n\n /**\n * Number of elements\n */\n get length(): number {\n return this.items.length\n }\n\n /**\n * Make iterable\n */\n *[Symbol.iterator](): Generator<T> {\n yield* this.items\n }\n\n /**\n * Convert to array\n */\n toArray(): T[] {\n return [...this.items]\n }\n}\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,IAAM,UAAN,MAAM,iBAAmB,IAAe;AAAA,EAC7C,YAAY,UAAwB;AAClC,UAAM;AACN,QAAI,UAAU;AACZ,iBAAW,QAAQ,UAAU;AAC3B,aAAK,UAAU,IAAI;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAK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20
20
|
compile: () => compile,
|
|
21
21
|
escape: () => escape,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
findAll: () => findAll,
|
|
23
|
+
findIter: () => findIter,
|
|
24
|
+
fullMatch: () => fullMatch,
|
|
25
25
|
match: () => match,
|
|
26
26
|
purge: () => purge,
|
|
27
27
|
search: () => search,
|
|
@@ -68,7 +68,7 @@ var Match = class {
|
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
70
|
/** Return a dictionary of named groups */
|
|
71
|
-
|
|
71
|
+
groupDict(defaultValue) {
|
|
72
72
|
const groups = this._match.groups ?? {};
|
|
73
73
|
const result = {};
|
|
74
74
|
for (const [key, value] of Object.entries(groups)) {
|
|
@@ -81,10 +81,10 @@ var Match = class {
|
|
|
81
81
|
if (groupNum === 0) {
|
|
82
82
|
return this._match.index;
|
|
83
83
|
}
|
|
84
|
-
const
|
|
84
|
+
const fullMatch2 = this._match[0];
|
|
85
85
|
const subMatch = this._match[groupNum];
|
|
86
|
-
if (!
|
|
87
|
-
const offset =
|
|
86
|
+
if (!fullMatch2 || !subMatch) return -1;
|
|
87
|
+
const offset = fullMatch2.indexOf(subMatch);
|
|
88
88
|
return offset >= 0 ? this._match.index + offset : -1;
|
|
89
89
|
}
|
|
90
90
|
/** Return the end index of the match */
|
|
@@ -107,16 +107,16 @@ var Match = class {
|
|
|
107
107
|
return this._endpos;
|
|
108
108
|
}
|
|
109
109
|
/** Return the last matched group index */
|
|
110
|
-
get
|
|
110
|
+
get lastIndex() {
|
|
111
111
|
for (let i = this._match.length - 1; i > 0; i--) {
|
|
112
112
|
if (this._match[i] !== void 0) return i;
|
|
113
113
|
}
|
|
114
114
|
return void 0;
|
|
115
115
|
}
|
|
116
116
|
/** Return the name of the last matched group */
|
|
117
|
-
get
|
|
117
|
+
get lastGroup() {
|
|
118
118
|
if (!this._match.groups) return void 0;
|
|
119
|
-
const lastIdx = this.
|
|
119
|
+
const lastIdx = this.lastIndex;
|
|
120
120
|
if (lastIdx === void 0) return void 0;
|
|
121
121
|
let idx = 1;
|
|
122
122
|
for (const name of Object.keys(this._match.groups)) {
|
|
@@ -195,7 +195,7 @@ var Pattern = class {
|
|
|
195
195
|
return null;
|
|
196
196
|
}
|
|
197
197
|
/** Match pattern against entire string */
|
|
198
|
-
|
|
198
|
+
fullMatch(string, pos = 0, endpos) {
|
|
199
199
|
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
200
200
|
const searchFrom = searchStr.slice(pos);
|
|
201
201
|
const regex = new RegExp("^(?:" + this._regex.source + ")$", this._regex.flags);
|
|
@@ -231,7 +231,7 @@ var Pattern = class {
|
|
|
231
231
|
return result;
|
|
232
232
|
}
|
|
233
233
|
/** Find all matches */
|
|
234
|
-
|
|
234
|
+
findAll(string, pos = 0, endpos) {
|
|
235
235
|
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
236
236
|
const searchFrom = searchStr.slice(pos);
|
|
237
237
|
const regex = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
@@ -249,7 +249,7 @@ var Pattern = class {
|
|
|
249
249
|
return results;
|
|
250
250
|
}
|
|
251
251
|
/** Find all matches as iterator */
|
|
252
|
-
*
|
|
252
|
+
*findIter(string, pos = 0, endpos) {
|
|
253
253
|
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
254
254
|
const searchFrom = searchStr.slice(pos);
|
|
255
255
|
const regex = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
@@ -335,7 +335,7 @@ var Pattern = class {
|
|
|
335
335
|
return count;
|
|
336
336
|
}
|
|
337
337
|
/** Return named groups mapping */
|
|
338
|
-
get
|
|
338
|
+
get groupIndex() {
|
|
339
339
|
const result = {};
|
|
340
340
|
let groupNum = 0;
|
|
341
341
|
const regex = /\(\?P?<(\w+)>/g;
|
|
@@ -364,21 +364,21 @@ function match(pattern, string, flags = 0) {
|
|
|
364
364
|
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
365
365
|
return p.match(string);
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function fullMatch(pattern, string, flags = 0) {
|
|
368
368
|
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
369
|
-
return p.
|
|
369
|
+
return p.fullMatch(string);
|
|
370
370
|
}
|
|
371
371
|
function split(pattern, string, maxsplit = 0, flags = 0) {
|
|
372
372
|
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
373
373
|
return p.split(string, maxsplit);
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function findAll(pattern, string, flags = 0) {
|
|
376
376
|
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
377
|
-
return p.
|
|
377
|
+
return p.findAll(string);
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function findIter(pattern, string, flags = 0) {
|
|
380
380
|
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
381
|
-
return p.
|
|
381
|
+
return p.findIter(string);
|
|
382
382
|
}
|
|
383
383
|
function sub(pattern, repl, string, count = 0, flags = 0) {
|
|
384
384
|
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
@@ -410,14 +410,14 @@ export {
|
|
|
410
410
|
compile,
|
|
411
411
|
search,
|
|
412
412
|
match,
|
|
413
|
-
|
|
413
|
+
fullMatch,
|
|
414
414
|
split,
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
findAll,
|
|
416
|
+
findIter,
|
|
417
417
|
sub,
|
|
418
418
|
subn,
|
|
419
419
|
escape,
|
|
420
420
|
purge,
|
|
421
421
|
re_exports
|
|
422
422
|
};
|
|
423
|
-
//# sourceMappingURL=chunk-
|
|
423
|
+
//# sourceMappingURL=chunk-7TH4FCVQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/re.ts"],"sourcesContent":["/**\n * Python re module for TypeScript\n *\n * Provides regular expression matching operations matching Python's re module.\n * Uses JavaScript's RegExp as the underlying engine.\n *\n * Note: Some Python regex features are not supported in JavaScript:\n * - Lookbehind assertions (limited support in modern JS)\n * - Named groups use different syntax (?P<name>...) vs (?<name>...)\n * - Verbose mode (x flag) is not supported\n *\n * @see {@link https://docs.python.org/3/library/re.html | Python re documentation}\n */\n\n// ============================================================================\n// Flags\n// ============================================================================\n\n/** Ignore case */\nexport const IGNORECASE = 2\nexport const I = IGNORECASE\n\n/** Multi-line mode */\nexport const MULTILINE = 8\nexport const M = MULTILINE\n\n/** Dot matches all (including newline) */\nexport const DOTALL = 16\nexport const S = DOTALL\n\n/** Unicode matching (always on in JS) */\nexport const UNICODE = 32\nexport const U = UNICODE\n\n/** ASCII-only matching */\nexport const ASCII = 256\nexport const A = ASCII\n\n// ============================================================================\n// Match object\n// ============================================================================\n\nexport class Match {\n private _match: RegExpExecArray\n private _string: string\n private _pattern: Pattern\n private _pos: number\n private _endpos: number\n\n constructor(\n match: RegExpExecArray,\n string: string,\n pattern: Pattern,\n pos: number = 0,\n endpos?: number\n ) {\n this._match = match\n this._string = string\n this._pattern = pattern\n this._pos = pos\n this._endpos = endpos ?? string.length\n }\n\n /** Return the string matched by the RE */\n group(groupNum: number | string = 0): string | undefined {\n if (typeof groupNum === \"number\") {\n return this._match[groupNum]\n }\n // Named group\n return this._match.groups?.[groupNum]\n }\n\n /** Return a tuple containing all subgroups */\n groups(defaultValue?: string): (string | undefined)[] {\n const result: (string | undefined)[] = []\n for (let i = 1; i < this._match.length; i++) {\n result.push(this._match[i] ?? defaultValue)\n }\n return result\n }\n\n /** Return a dictionary of named groups */\n groupDict(defaultValue?: string): Record<string, string | undefined> {\n const groups = this._match.groups ?? {}\n const result: Record<string, string | undefined> = {}\n for (const [key, value] of Object.entries(groups)) {\n // Groups can have undefined values for non-participating groups\n result[key] = (value as string | undefined) ?? defaultValue\n }\n return result\n }\n\n /** Return the start index of the match */\n start(groupNum: number = 0): number {\n if (groupNum === 0) {\n return this._match.index\n }\n // For subgroups, we need to find the position\n const fullMatch = this._match[0]\n const subMatch = this._match[groupNum]\n if (!fullMatch || !subMatch) return -1\n const offset = fullMatch.indexOf(subMatch)\n return offset >= 0 ? this._match.index + offset : -1\n }\n\n /** Return the end index of the match */\n end(groupNum: number = 0): number {\n const s = this.start(groupNum)\n const g = this.group(groupNum)\n if (s < 0 || g === undefined) return -1\n return s + g.length\n }\n\n /** Return a tuple (start, end) */\n span(groupNum: number = 0): [number, number] {\n return [this.start(groupNum), this.end(groupNum)]\n }\n\n /** Return start position of search */\n get pos(): number {\n return this._pos\n }\n\n /** Return end position of search */\n get endpos(): number {\n return this._endpos\n }\n\n /** Return the last matched group index */\n get lastIndex(): number | undefined {\n for (let i = this._match.length - 1; i > 0; i--) {\n if (this._match[i] !== undefined) return i\n }\n return undefined\n }\n\n /** Return the name of the last matched group */\n get lastGroup(): string | undefined {\n if (!this._match.groups) return undefined\n const lastIdx = this.lastIndex\n if (lastIdx === undefined) return undefined\n // Find the name for this index\n let idx = 1\n for (const name of Object.keys(this._match.groups)) {\n if (idx === lastIdx) return name\n idx++\n }\n return undefined\n }\n\n /** Return the pattern object */\n get re(): Pattern {\n return this._pattern\n }\n\n /** Return the input string */\n get string(): string {\n return this._string\n }\n\n /** Expand template with groups */\n expand(template: string): string {\n return template.replace(/\\\\(\\d+)|\\\\g<(\\w+)>/g, (_, num: string | undefined, name: string) => {\n if (num) {\n return this.group(parseInt(num)) ?? \"\"\n }\n return this.group(name) ?? \"\"\n })\n }\n\n /** Return iterator of all groups */\n *[Symbol.iterator](): Generator<string | undefined> {\n for (let i = 0; i < this._match.length; i++) {\n yield this._match[i]\n }\n }\n\n toString(): string {\n return `<re.Match object; span=(${String(this.start())}, ${String(this.end())}), match='${this.group() ?? \"\"}'>`\n }\n}\n\n// ============================================================================\n// Pattern object\n// ============================================================================\n\nexport class Pattern {\n private _regex: RegExp\n private _pattern: string\n private _flags: number\n\n constructor(pattern: string, flags: number = 0) {\n this._pattern = pattern\n this._flags = flags\n this._regex = this._compileRegex(pattern, flags)\n }\n\n private _compileRegex(pattern: string, flags: number): RegExp {\n // Convert Python regex syntax to JavaScript\n const jsPattern = pattern\n // Convert Python named groups (?P<name>...) to JS (?<name>...)\n .replace(/\\(\\?P<(\\w+)>/g, \"(?<$1>\")\n // Convert Python named backreferences (?P=name) to JS \\k<name>\n .replace(/\\(\\?P=(\\w+)\\)/g, \"\\\\k<$1>\")\n\n let jsFlags = \"\"\n if (flags & IGNORECASE) jsFlags += \"i\"\n if (flags & MULTILINE) jsFlags += \"m\"\n if (flags & DOTALL) jsFlags += \"s\"\n jsFlags += \"u\" // Always use unicode\n\n return new RegExp(jsPattern, jsFlags)\n }\n\n /** Search for pattern in string */\n search(string: string, pos: number = 0, endpos?: number): Match | null {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n const regex = new RegExp(this._regex.source, this._regex.flags)\n const match = regex.exec(searchFrom)\n\n if (match) {\n match.index += pos\n return new Match(match, string, this, pos, endpos)\n }\n return null\n }\n\n /** Match pattern at start of string */\n match(string: string, pos: number = 0, endpos?: number): Match | null {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n // Force match at start\n const regex = new RegExp(\"^(?:\" + this._regex.source + \")\", this._regex.flags)\n const match = regex.exec(searchFrom)\n\n if (match) {\n match.index += pos\n return new Match(match, string, this, pos, endpos)\n }\n return null\n }\n\n /** Match pattern against entire string */\n fullMatch(string: string, pos: number = 0, endpos?: number): Match | null {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n // Force match entire string\n const regex = new RegExp(\"^(?:\" + this._regex.source + \")$\", this._regex.flags)\n const match = regex.exec(searchFrom)\n\n if (match) {\n match.index += pos\n return new Match(match, string, this, pos, endpos)\n }\n return null\n }\n\n /** Split string by pattern */\n split(string: string, maxsplit: number = 0): string[] {\n if (maxsplit === 0) {\n return string.split(this._regex)\n }\n\n const result: string[] = []\n let lastIndex = 0\n let count = 0\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n\n let match: RegExpExecArray | null\n while ((match = regex.exec(string)) !== null && (maxsplit === 0 || count < maxsplit)) {\n result.push(string.slice(lastIndex, match.index))\n // Add captured groups\n for (let i = 1; i < match.length; i++) {\n const group = match[i]\n if (group !== undefined) {\n result.push(group)\n }\n }\n lastIndex = regex.lastIndex\n count++\n }\n result.push(string.slice(lastIndex))\n return result\n }\n\n /** Find all matches */\n findAll(string: string, pos: number = 0, endpos?: number): (string | string[])[] {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n const results: (string | string[])[] = []\n\n let match: RegExpExecArray | null\n while ((match = regex.exec(searchFrom)) !== null) {\n if (match.length === 1) {\n results.push(match[0])\n } else if (match.length === 2 && match[1] !== undefined) {\n results.push(match[1])\n } else {\n results.push(match.slice(1))\n }\n }\n return results\n }\n\n /** Find all matches as iterator */\n *findIter(string: string, pos: number = 0, endpos?: number): Generator<Match> {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n\n let match: RegExpExecArray | null\n while ((match = regex.exec(searchFrom)) !== null) {\n match.index += pos\n yield new Match(match, string, this, pos, endpos)\n }\n }\n\n /** Replace pattern in string */\n sub(repl: string | ((match: Match) => string), string: string, count: number = 0): string {\n if (typeof repl === \"function\") {\n let n = 0\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n return string.replace(regex, (...args) => {\n if (count > 0 && n >= count) {\n return args[0]\n }\n n++\n const match = regex.exec(string)\n if (!match) return args[0]\n return repl(new Match(match, string, this))\n })\n }\n\n // Convert Python replacement syntax\n const jsRepl = repl.replace(/\\\\g<(\\w+)>/g, \"$<$1>\").replace(/\\\\(\\d+)/g, \"$$$1\")\n\n if (count === 0) {\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n return string.replace(regex, jsRepl)\n }\n\n let result = string\n let n = 0\n const regex = new RegExp(this._regex.source, this._regex.flags)\n while (n < count) {\n const newResult = result.replace(regex, jsRepl)\n if (newResult === result) break\n result = newResult\n n++\n }\n return result\n }\n\n /** Replace pattern and return (newstring, count) */\n subn(\n repl: string | ((match: Match) => string),\n string: string,\n count: number = 0\n ): [string, number] {\n let n = 0\n const result = this.sub(\n typeof repl === \"function\"\n ? (m) => {\n n++\n return repl(m)\n }\n : repl,\n string,\n count\n )\n if (typeof repl === \"string\") {\n // Count replacements\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n const matches = string.match(regex)\n n = matches ? (count > 0 ? Math.min(matches.length, count) : matches.length) : 0\n }\n return [result, n]\n }\n\n /** Return the pattern string */\n get pattern(): string {\n return this._pattern\n }\n\n /** Return the flags */\n get flags(): number {\n return this._flags\n }\n\n /** Return number of groups */\n get groups(): number {\n // Count groups in pattern\n let count = 0\n for (let i = 0; i < this._pattern.length; i++) {\n if (this._pattern[i] === \"\\\\\") {\n i++\n continue\n }\n if (this._pattern[i] === \"(\") {\n if (this._pattern[i + 1] !== \"?\") {\n count++\n } else if (\n this._pattern.slice(i + 1, i + 4) === \"?P<\" ||\n this._pattern.slice(i + 1, i + 3) === \"?<\"\n ) {\n count++\n }\n }\n }\n return count\n }\n\n /** Return named groups mapping */\n get groupIndex(): Record<string, number> {\n const result: Record<string, number> = {}\n let groupNum = 0\n const regex = /\\(\\?P?<(\\w+)>/g\n let match: RegExpExecArray | null\n while ((match = regex.exec(this._pattern)) !== null) {\n groupNum++\n const name = match[1]\n if (name) {\n result[name] = groupNum\n }\n }\n return result\n }\n\n toString(): string {\n return `re.compile('${this._pattern}')`\n }\n}\n\n// ============================================================================\n// Module functions\n// ============================================================================\n\n/** Compile a regular expression pattern */\nexport function compile(pattern: string, flags: number = 0): Pattern {\n return new Pattern(pattern, flags)\n}\n\n/** Search for pattern in string */\nexport function search(pattern: string | Pattern, string: string, flags: number = 0): Match | null {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.search(string)\n}\n\n/** Match pattern at start of string */\nexport function match(pattern: string | Pattern, string: string, flags: number = 0): Match | null {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.match(string)\n}\n\n/** Match pattern against entire string */\nexport function fullMatch(\n pattern: string | Pattern,\n string: string,\n flags: number = 0\n): Match | null {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.fullMatch(string)\n}\n\n/** Split string by pattern */\nexport function split(\n pattern: string | Pattern,\n string: string,\n maxsplit: number = 0,\n flags: number = 0\n): string[] {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.split(string, maxsplit)\n}\n\n/** Find all matches */\nexport function findAll(\n pattern: string | Pattern,\n string: string,\n flags: number = 0\n): (string | string[])[] {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.findAll(string)\n}\n\n/** Find all matches as iterator */\nexport function findIter(\n pattern: string | Pattern,\n string: string,\n flags: number = 0\n): Generator<Match> {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.findIter(string)\n}\n\n/** Replace pattern in string */\nexport function sub(\n pattern: string | Pattern,\n repl: string | ((match: Match) => string),\n string: string,\n count: number = 0,\n flags: number = 0\n): string {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.sub(repl, string, count)\n}\n\n/** Replace pattern and return (newstring, count) */\nexport function subn(\n pattern: string | Pattern,\n repl: string | ((match: Match) => string),\n string: string,\n count: number = 0,\n flags: number = 0\n): [string, number] {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.subn(repl, string, count)\n}\n\n/** Escape special characters in pattern */\nexport function escape(pattern: string): string {\n return pattern.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n}\n\n/** Purge the regex cache (no-op in this implementation) */\nexport function purge(): void {\n // No cache to purge\n}\n"],"mappings":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,QAAQ,SAAS,KAAK;AACvE,SAAO,EAAE,KAAK,MAAM,QAAQ,KAAK;AACnC;AAGO,SAAS,OAAO,SAAyB;AAC9C,SAAO,QAAQ,QAAQ,uBAAuB,MAAM;AACtD;AAGO,SAAS,QAAc;AAE9B;","names":["match","fullMatch","n","regex"]}
|
|
@@ -5,24 +5,24 @@ import {
|
|
|
5
5
|
// src/os.ts
|
|
6
6
|
var os_exports = {};
|
|
7
7
|
__export(os_exports, {
|
|
8
|
-
|
|
8
|
+
altSep: () => altSep,
|
|
9
9
|
chdir: () => chdir,
|
|
10
|
-
|
|
10
|
+
curDir: () => curDir,
|
|
11
11
|
environ: () => environ,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
extSep: () => extSep,
|
|
13
|
+
getCwd: () => getCwd,
|
|
14
|
+
getCwdb: () => getCwdb,
|
|
15
15
|
getenv: () => getenv,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
lineSep: () => lineSep,
|
|
17
|
+
listDir: () => listDir,
|
|
18
|
+
makeDirs: () => makeDirs,
|
|
19
19
|
mkdir: () => mkdir,
|
|
20
20
|
name: () => name,
|
|
21
|
-
|
|
21
|
+
parDir: () => parDir,
|
|
22
22
|
path: () => path,
|
|
23
|
-
|
|
23
|
+
pathSep: () => pathSep,
|
|
24
24
|
remove: () => remove,
|
|
25
|
-
|
|
25
|
+
removeDirs: () => removeDirs,
|
|
26
26
|
rename: () => rename,
|
|
27
27
|
renames: () => renames,
|
|
28
28
|
replace: () => replace,
|
|
@@ -37,12 +37,12 @@ function getenv(key, defaultValue) {
|
|
|
37
37
|
return environ[key] ?? defaultValue;
|
|
38
38
|
}
|
|
39
39
|
var sep = typeof process !== "undefined" && process.platform === "win32" ? "\\" : "/";
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
40
|
+
var altSep = typeof process !== "undefined" && process.platform === "win32" ? "/" : null;
|
|
41
|
+
var pathSep = typeof process !== "undefined" && process.platform === "win32" ? ";" : ":";
|
|
42
|
+
var lineSep = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
|
|
43
|
+
var curDir = ".";
|
|
44
|
+
var parDir = "..";
|
|
45
|
+
var extSep = ".";
|
|
46
46
|
var path = {
|
|
47
47
|
/** Join path components intelligently */
|
|
48
48
|
join(...paths) {
|
|
@@ -84,7 +84,7 @@ var path = {
|
|
|
84
84
|
return [path.dirname(p), path.basename(p)];
|
|
85
85
|
},
|
|
86
86
|
/** Split pathname into root and extension */
|
|
87
|
-
|
|
87
|
+
splitExt(p) {
|
|
88
88
|
const base = path.basename(p);
|
|
89
89
|
const dotIdx = base.lastIndexOf(".");
|
|
90
90
|
if (dotIdx <= 0) {
|
|
@@ -96,18 +96,18 @@ var path = {
|
|
|
96
96
|
return [dir ? path.join(dir, root) : root, ext];
|
|
97
97
|
},
|
|
98
98
|
/** Return the extension of pathname */
|
|
99
|
-
|
|
100
|
-
return path.
|
|
99
|
+
extName(p) {
|
|
100
|
+
return path.splitExt(p)[1];
|
|
101
101
|
},
|
|
102
102
|
/** Test whether a path is absolute */
|
|
103
|
-
|
|
103
|
+
isAbs(p) {
|
|
104
104
|
if (p.startsWith("/")) return true;
|
|
105
105
|
if (p.length >= 3 && p[1] === ":" && (p[2] === "/" || p[2] === "\\")) return true;
|
|
106
106
|
if (p.startsWith("\\\\")) return true;
|
|
107
107
|
return false;
|
|
108
108
|
},
|
|
109
109
|
/** Normalize a pathname */
|
|
110
|
-
|
|
110
|
+
normPath(p) {
|
|
111
111
|
if (!p) return ".";
|
|
112
112
|
let prefix = "";
|
|
113
113
|
if (p.length >= 2 && p[1] === ":") {
|
|
@@ -138,20 +138,20 @@ var path = {
|
|
|
138
138
|
return normalized || ".";
|
|
139
139
|
},
|
|
140
140
|
/** Return normalized absolutized version of pathname */
|
|
141
|
-
|
|
142
|
-
if (path.
|
|
143
|
-
return path.
|
|
141
|
+
absPath(p) {
|
|
142
|
+
if (path.isAbs(p)) {
|
|
143
|
+
return path.normPath(p);
|
|
144
144
|
}
|
|
145
|
-
return path.
|
|
145
|
+
return path.normPath(p);
|
|
146
146
|
},
|
|
147
147
|
/** Return canonical path, eliminating symlinks (stub - just normalizes) */
|
|
148
|
-
|
|
149
|
-
return path.
|
|
148
|
+
realPath(p) {
|
|
149
|
+
return path.absPath(p);
|
|
150
150
|
},
|
|
151
151
|
/** Return relative path from start to path */
|
|
152
|
-
|
|
153
|
-
const pParts = path.
|
|
154
|
-
const startParts = path.
|
|
152
|
+
relPath(p, start = ".") {
|
|
153
|
+
const pParts = path.normPath(p).split(/[/\\]/).filter(Boolean);
|
|
154
|
+
const startParts = path.normPath(start).split(/[/\\]/).filter(Boolean);
|
|
155
155
|
let commonLen = 0;
|
|
156
156
|
const minLen = Math.min(pParts.length, startParts.length);
|
|
157
157
|
for (let i = 0; i < minLen; i++) {
|
|
@@ -166,11 +166,11 @@ var path = {
|
|
|
166
166
|
return result.join(sep) || ".";
|
|
167
167
|
},
|
|
168
168
|
/** Return common path prefix */
|
|
169
|
-
|
|
169
|
+
commonPath(paths) {
|
|
170
170
|
if (paths.length === 0) {
|
|
171
|
-
throw new Error("
|
|
171
|
+
throw new Error("commonPath() arg is an empty sequence");
|
|
172
172
|
}
|
|
173
|
-
const splitPaths = paths.map((p) => path.
|
|
173
|
+
const splitPaths = paths.map((p) => path.normPath(p).split(/[/\\]/));
|
|
174
174
|
const first = splitPaths[0];
|
|
175
175
|
let commonLen = first.length;
|
|
176
176
|
for (let i = 1; i < splitPaths.length; i++) {
|
|
@@ -186,7 +186,7 @@ var path = {
|
|
|
186
186
|
return first.slice(0, commonLen).join(sep) || sep;
|
|
187
187
|
},
|
|
188
188
|
/** Expand ~ and ~user (stub - returns unchanged in browser) */
|
|
189
|
-
|
|
189
|
+
expandUser(p) {
|
|
190
190
|
if (!p.startsWith("~")) return p;
|
|
191
191
|
const home = typeof process !== "undefined" ? process.env.HOME ?? process.env.USERPROFILE : void 0;
|
|
192
192
|
if (!home) return p;
|
|
@@ -196,74 +196,76 @@ var path = {
|
|
|
196
196
|
return p;
|
|
197
197
|
},
|
|
198
198
|
/** Expand shell variables (stub - returns unchanged) */
|
|
199
|
-
|
|
199
|
+
expandVars(p) {
|
|
200
200
|
return p.replace(/\$(\w+)|\$\{(\w+)\}/g, (_, v1, v2) => {
|
|
201
201
|
const key = v1 || v2;
|
|
202
202
|
return environ[key] ?? "";
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
|
+
/* v8 ignore start -- browser stubs @preserve */
|
|
205
206
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
206
207
|
/** Test if path exists (stub - always returns false in browser) */
|
|
207
208
|
exists(_p) {
|
|
208
209
|
return false;
|
|
209
210
|
},
|
|
210
211
|
/** Test if path is a file (stub - always returns false in browser) */
|
|
211
|
-
|
|
212
|
+
isFile(_p) {
|
|
212
213
|
return false;
|
|
213
214
|
},
|
|
214
215
|
/** Test if path is a directory (stub - always returns false in browser) */
|
|
215
|
-
|
|
216
|
+
isDir(_p) {
|
|
216
217
|
return false;
|
|
217
218
|
},
|
|
218
219
|
/** Test if path is a symbolic link (stub - always returns false in browser) */
|
|
219
|
-
|
|
220
|
+
isLink(_p) {
|
|
220
221
|
return false;
|
|
221
222
|
},
|
|
222
223
|
/** Return size of file (stub - returns 0 in browser) */
|
|
223
|
-
|
|
224
|
+
getSize(_p) {
|
|
224
225
|
return 0;
|
|
225
226
|
},
|
|
226
227
|
/** Return modification time (stub - returns 0 in browser) */
|
|
227
|
-
|
|
228
|
+
getMtime(_p) {
|
|
228
229
|
return 0;
|
|
229
230
|
},
|
|
230
231
|
/** Return access time (stub - returns 0 in browser) */
|
|
231
|
-
|
|
232
|
+
getAtime(_p) {
|
|
232
233
|
return 0;
|
|
233
234
|
},
|
|
234
235
|
/** Return creation time (stub - returns 0 in browser) */
|
|
235
|
-
|
|
236
|
+
getCtime(_p) {
|
|
236
237
|
return 0;
|
|
237
238
|
}
|
|
238
239
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
240
|
+
/* v8 ignore stop */
|
|
239
241
|
};
|
|
240
|
-
function
|
|
242
|
+
function getCwd() {
|
|
241
243
|
if (typeof process !== "undefined") {
|
|
242
244
|
return process.cwd();
|
|
243
245
|
}
|
|
244
246
|
return "/";
|
|
245
247
|
}
|
|
246
|
-
function
|
|
247
|
-
return
|
|
248
|
+
function getCwdb() {
|
|
249
|
+
return getCwd();
|
|
248
250
|
}
|
|
249
251
|
function chdir(p) {
|
|
250
252
|
if (typeof process !== "undefined") {
|
|
251
253
|
process.chdir(p);
|
|
252
254
|
}
|
|
253
255
|
}
|
|
254
|
-
function
|
|
256
|
+
function listDir(_p = ".") {
|
|
255
257
|
return [];
|
|
256
258
|
}
|
|
257
259
|
function mkdir(_p, _mode = 511) {
|
|
258
260
|
}
|
|
259
|
-
function
|
|
261
|
+
function makeDirs(_p, _mode = 511, _existOk = false) {
|
|
260
262
|
}
|
|
261
263
|
function remove(_p) {
|
|
262
264
|
}
|
|
263
265
|
var unlink = remove;
|
|
264
266
|
function rmdir(_p) {
|
|
265
267
|
}
|
|
266
|
-
function
|
|
268
|
+
function removeDirs(_p) {
|
|
267
269
|
}
|
|
268
270
|
function rename(_src, _dst) {
|
|
269
271
|
}
|
|
@@ -282,23 +284,23 @@ export {
|
|
|
282
284
|
environ,
|
|
283
285
|
getenv,
|
|
284
286
|
sep,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
altSep,
|
|
288
|
+
pathSep,
|
|
289
|
+
lineSep,
|
|
290
|
+
curDir,
|
|
291
|
+
parDir,
|
|
292
|
+
extSep,
|
|
291
293
|
path,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
getCwd,
|
|
295
|
+
getCwdb,
|
|
294
296
|
chdir,
|
|
295
|
-
|
|
297
|
+
listDir,
|
|
296
298
|
mkdir,
|
|
297
|
-
|
|
299
|
+
makeDirs,
|
|
298
300
|
remove,
|
|
299
301
|
unlink,
|
|
300
302
|
rmdir,
|
|
301
|
-
|
|
303
|
+
removeDirs,
|
|
302
304
|
rename,
|
|
303
305
|
renames,
|
|
304
306
|
replace,
|
|
@@ -307,4 +309,5 @@ export {
|
|
|
307
309
|
name,
|
|
308
310
|
os_exports
|
|
309
311
|
};
|
|
310
|
-
|
|
312
|
+
/* v8 ignore start -- browser stubs for filesystem operations @preserve */
|
|
313
|
+
//# sourceMappingURL=chunk-CXKGPD5D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/os.ts"],"sourcesContent":["/**\n * Python os module for TypeScript\n *\n * Provides operating system interface functions matching Python's os module.\n * Note: This is a browser-compatible subset. Some functions are stubs.\n *\n * @see {@link https://docs.python.org/3/library/os.html | Python os documentation}\n * @see {@link https://docs.python.org/3/library/os.path.html | Python os.path documentation}\n */\n\n// ============================================================================\n// Environment variables\n// ============================================================================\n\n/** Environment variables (browser-safe empty object or Node's process.env) */\nexport const environ: Record<string, string | undefined> =\n typeof process !== \"undefined\" ? process.env : {}\n\n/** Get an environment variable */\nexport function getenv(key: string, defaultValue?: string): string | undefined {\n return environ[key] ?? defaultValue\n}\n\n// ============================================================================\n// Path separator constants\n// ============================================================================\n\n/** Path separator for the current platform */\nexport const sep = typeof process !== \"undefined\" && process.platform === \"win32\" ? \"\\\\\" : \"/\"\n\n/** Alternative path separator (Windows has both / and \\) */\nexport const altSep = typeof process !== \"undefined\" && process.platform === \"win32\" ? \"/\" : null\n\n/** Path list separator (: on Unix, ; on Windows) */\nexport const pathSep = typeof process !== \"undefined\" && process.platform === \"win32\" ? \";\" : \":\"\n\n/** Line separator */\nexport const lineSep =\n typeof process !== \"undefined\" && process.platform === \"win32\" ? \"\\r\\n\" : \"\\n\"\n\n/** Current directory string */\nexport const curDir = \".\"\n\n/** Parent directory string */\nexport const parDir = \"..\"\n\n/** Extension separator */\nexport const extSep = \".\"\n\n// ============================================================================\n// os.path module\n// ============================================================================\n\nexport const path = {\n /** Join path components intelligently */\n join(...paths: string[]): string {\n if (paths.length === 0) return \"\"\n if (paths.length === 1) return paths[0] ?? \"\"\n\n let result = paths[0] ?? \"\"\n for (let i = 1; i < paths.length; i++) {\n const p = paths[i] ?? \"\"\n if (p.startsWith(\"/\") || (p.length > 1 && p[1] === \":\")) {\n // Absolute path - start fresh\n result = p\n } else if (result === \"\" || result.endsWith(\"/\") || result.endsWith(\"\\\\\")) {\n result += p\n } else {\n result += sep + p\n }\n }\n return result\n },\n\n /** Return the base name of pathname */\n basename(p: string, suffix?: string): string {\n // Remove trailing slashes\n let s = p.replace(/[/\\\\]+$/, \"\")\n // Get last component\n const idx = Math.max(s.lastIndexOf(\"/\"), s.lastIndexOf(\"\\\\\"))\n s = idx >= 0 ? s.slice(idx + 1) : s\n // Remove suffix if provided\n if (suffix && s.endsWith(suffix)) {\n s = s.slice(0, -suffix.length)\n }\n return s\n },\n\n /** Return the directory name of pathname */\n dirname(p: string): string {\n // Remove trailing slashes\n const s = p.replace(/[/\\\\]+$/, \"\")\n const idx = Math.max(s.lastIndexOf(\"/\"), s.lastIndexOf(\"\\\\\"))\n if (idx < 0) return \"\"\n if (idx === 0) return s[0] ?? \"\"\n return s.slice(0, idx)\n },\n\n /** Split pathname into (head, tail) */\n split(p: string): [string, string] {\n return [path.dirname(p), path.basename(p)]\n },\n\n /** Split pathname into root and extension */\n splitExt(p: string): [string, string] {\n const base = path.basename(p)\n const dotIdx = base.lastIndexOf(\".\")\n if (dotIdx <= 0) {\n return [p, \"\"]\n }\n const dir = path.dirname(p)\n const root = base.slice(0, dotIdx)\n const ext = base.slice(dotIdx)\n return [dir ? path.join(dir, root) : root, ext]\n },\n\n /** Return the extension of pathname */\n extName(p: string): string {\n return path.splitExt(p)[1]\n },\n\n /** Test whether a path is absolute */\n isAbs(p: string): boolean {\n if (p.startsWith(\"/\")) return true\n // Windows: C:\\ or C:/\n if (p.length >= 3 && p[1] === \":\" && (p[2] === \"/\" || p[2] === \"\\\\\")) return true\n // Windows UNC: \\\\server\\share\n if (p.startsWith(\"\\\\\\\\\")) return true\n return false\n },\n\n /** Normalize a pathname */\n normPath(p: string): string {\n if (!p) return \".\"\n\n // Handle Windows drive letter\n let prefix = \"\"\n if (p.length >= 2 && p[1] === \":\") {\n prefix = p.slice(0, 2)\n p = p.slice(2)\n }\n\n // Replace backslashes with forward slashes for processing\n const isWin = p.includes(\"\\\\\")\n p = p.replace(/\\\\/g, \"/\")\n\n // Split and process\n const isAbsolute = p.startsWith(\"/\")\n const parts = p.split(\"/\").filter((part) => part && part !== \".\")\n const result: string[] = []\n\n for (const part of parts) {\n if (part === \"..\") {\n if (result.length > 0 && result[result.length - 1] !== \"..\") {\n result.pop()\n } else if (!isAbsolute) {\n result.push(\"..\")\n }\n } else {\n result.push(part)\n }\n }\n\n let normalized = result.join(isWin ? \"\\\\\" : \"/\")\n if (isAbsolute) {\n normalized = (isWin ? \"\\\\\" : \"/\") + normalized\n }\n normalized = prefix + normalized\n\n return normalized || \".\"\n },\n\n /** Return normalized absolutized version of pathname */\n absPath(p: string): string {\n if (path.isAbs(p)) {\n return path.normPath(p)\n }\n // In browser, we can't get cwd, so just normalize\n return path.normPath(p)\n },\n\n /** Return canonical path, eliminating symlinks (stub - just normalizes) */\n realPath(p: string): string {\n return path.absPath(p)\n },\n\n /** Return relative path from start to path */\n relPath(p: string, start: string = \".\"): string {\n const pParts = path.normPath(p).split(/[/\\\\]/).filter(Boolean)\n const startParts = path.normPath(start).split(/[/\\\\]/).filter(Boolean)\n\n // Find common prefix length\n let commonLen = 0\n const minLen = Math.min(pParts.length, startParts.length)\n for (let i = 0; i < minLen; i++) {\n if (pParts[i] === startParts[i]) {\n commonLen++\n } else {\n break\n }\n }\n\n // Build relative path\n const upCount = startParts.length - commonLen\n const result = [...Array<string>(upCount).fill(\"..\"), ...pParts.slice(commonLen)]\n return result.join(sep) || \".\"\n },\n\n /** Return common path prefix */\n commonPath(paths: string[]): string {\n if (paths.length === 0) {\n throw new Error(\"commonPath() arg is an empty sequence\")\n }\n\n const splitPaths = paths.map((p) => path.normPath(p).split(/[/\\\\]/))\n const first = splitPaths[0] as string[]\n let commonLen = first.length\n\n for (let i = 1; i < splitPaths.length; i++) {\n const parts = splitPaths[i] as string[]\n commonLen = Math.min(commonLen, parts.length)\n for (let j = 0; j < commonLen; j++) {\n if (parts[j] !== first[j]) {\n commonLen = j\n break\n }\n }\n }\n\n return first.slice(0, commonLen).join(sep) || sep\n },\n\n /** Expand ~ and ~user (stub - returns unchanged in browser) */\n expandUser(p: string): string {\n if (!p.startsWith(\"~\")) return p\n const home =\n typeof process !== \"undefined\" ? (process.env.HOME ?? process.env.USERPROFILE) : undefined\n if (!home) return p\n if (p === \"~\" || p.startsWith(\"~/\") || p.startsWith(\"~\\\\\")) {\n return home + p.slice(1)\n }\n return p\n },\n\n /** Expand shell variables (stub - returns unchanged) */\n expandVars(p: string): string {\n // Simple $VAR and ${VAR} expansion\n return p.replace(/\\$(\\w+)|\\$\\{(\\w+)\\}/g, (_, v1: string, v2: string) => {\n const key = v1 || v2\n return environ[key] ?? \"\"\n })\n },\n\n /* v8 ignore start -- browser stubs @preserve */\n /* eslint-disable @typescript-eslint/no-unused-vars */\n /** Test if path exists (stub - always returns false in browser) */\n exists(_p: string): boolean {\n return false\n },\n\n /** Test if path is a file (stub - always returns false in browser) */\n isFile(_p: string): boolean {\n return false\n },\n\n /** Test if path is a directory (stub - always returns false in browser) */\n isDir(_p: string): boolean {\n return false\n },\n\n /** Test if path is a symbolic link (stub - always returns false in browser) */\n isLink(_p: string): boolean {\n return false\n },\n\n /** Return size of file (stub - returns 0 in browser) */\n getSize(_p: string): number {\n return 0\n },\n\n /** Return modification time (stub - returns 0 in browser) */\n getMtime(_p: string): number {\n return 0\n },\n\n /** Return access time (stub - returns 0 in browser) */\n getAtime(_p: string): number {\n return 0\n },\n\n /** Return creation time (stub - returns 0 in browser) */\n getCtime(_p: string): number {\n return 0\n }\n /* eslint-enable @typescript-eslint/no-unused-vars */\n /* v8 ignore stop */\n}\n\n// ============================================================================\n// Process functions (stubs for browser compatibility)\n// ============================================================================\n\n/** Get current working directory */\nexport function getCwd(): string {\n if (typeof process !== \"undefined\") {\n return process.cwd()\n }\n return \"/\"\n}\n\n/** Get current working directory as bytes (same as getCwd in TS) */\nexport function getCwdb(): string {\n return getCwd()\n}\n\n/** Change current working directory (stub in browser) */\nexport function chdir(p: string): void {\n if (typeof process !== \"undefined\") {\n process.chdir(p)\n }\n}\n\n/* v8 ignore start -- browser stubs for filesystem operations @preserve */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/** List directory contents (stub - returns empty array in browser) */\nexport function listDir(_p: string = \".\"): string[] {\n return []\n}\n\n/** Create a directory (stub in browser) */\nexport function mkdir(_p: string, _mode: number = 0o777): void {\n // No-op in browser\n}\n\n/** Create a directory and parents (stub in browser) */\nexport function makeDirs(_p: string, _mode: number = 0o777, _existOk: boolean = false): void {\n // No-op in browser\n}\n\n/** Remove a file (stub in browser) */\nexport function remove(_p: string): void {\n // No-op in browser\n}\n\n/** Remove a file (alias for remove) */\nexport const unlink = remove\n\n/** Remove a directory (stub in browser) */\nexport function rmdir(_p: string): void {\n // No-op in browser\n}\n\n/** Remove directory tree (stub in browser) */\nexport function removeDirs(_p: string): void {\n // No-op in browser\n}\n\n/** Rename a file or directory (stub in browser) */\nexport function rename(_src: string, _dst: string): void {\n // No-op in browser\n}\n\n/** Rename with automatic directory creation (stub in browser) */\nexport function renames(_src: string, _dst: string): void {\n // No-op in browser\n}\n\n/** Replace file (stub in browser) */\nexport function replace(_src: string, _dst: string): void {\n // No-op in browser\n}\n\n/** Walk directory tree (stub - yields nothing in browser) */\nexport function* walk(\n _top: string,\n _options?: { topdown?: boolean; followlinks?: boolean }\n): Generator<[string, string[], string[]]> {\n // No-op in browser\n}\n\n/** Get file stat (stub in browser) */\nexport function stat(_p: string): {\n st_mode: number\n st_size: number\n st_mtime: number\n st_atime: number\n st_ctime: number\n} {\n return { st_mode: 0, st_size: 0, st_mtime: 0, st_atime: 0, st_ctime: 0 }\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n/* v8 ignore stop */\n\n// ============================================================================\n// Name and platform info\n// ============================================================================\n\n/** Operating system name */\nexport const name: string =\n typeof process !== \"undefined\" && process.platform === \"win32\" ? \"nt\" : \"posix\"\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,IAAM,UACX,OAAO,YAAY,cAAc,QAAQ,MAAM,CAAC;AAG3C,SAAS,OAAO,KAAa,cAA2C;AAC7E,SAAO,QAAQ,GAAG,KAAK;AACzB;AAOO,IAAM,MAAM,OAAO,YAAY,eAAe,QAAQ,aAAa,UAAU,OAAO;AAGpF,IAAM,SAAS,OAAO,YAAY,eAAe,QAAQ,aAAa,UAAU,MAAM;AAGtF,IAAM,UAAU,OAAO,YAAY,eAAe,QAAQ,aAAa,UAAU,MAAM;AAGvF,IAAM,UACX,OAAO,YAAY,eAAe,QAAQ,aAAa,UAAU,SAAS;AAGrE,IAAM,SAAS;AAGf,IAAM,SAAS;AAGf,IAAM,SAAS;AAMf,IAAM,OAAO;AAAA;AAAA,EAElB,QAAQ,OAAyB;AAC/B,QAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,QAAI,MAAM,WAAW,EAAG,QAAO,MAAM,CAAC,KAAK;AAE3C,QAAI,SAAS,MAAM,CAAC,KAAK;AACzB,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,YAAM,IAAI,MAAM,CAAC,KAAK;AACtB,UAAI,EAAE,WAAW,GAAG,KAAM,EAAE,SAAS,KAAK,EAAE,CAAC,MAAM,KAAM;AAEvD,iBA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