thefrontside / thefrontside/effection

Remove Deno shims from bundle

Open
#1,063 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

chore
Dominant language
TypeScript
Stars
856
Forks
39
Avg merge
2d 8h
Merged PRs (30d)
8

Description

We're getting some Deno shims - maybe for CJS support.

https://www.npmjs.com/package/effection?activeTab=code

const dntGlobals = {};
2export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
3function createMergeProxy(baseObj, extObj) {
4    return new Proxy(baseObj, {
5        get(_target, prop, _receiver) {
6            if (prop in extObj) {
7                return extObj[prop];
8            }
9            else {
10                return baseObj[prop];
11            }
12        },
13        set(_target, prop, value) {
14            if (prop in extObj) {
15                delete extObj[prop];
16            }
17            baseObj[prop] = value;
18            return true;
19        },
20        deleteProperty(_target, prop) {
21            let success = false;
22            if (prop in extObj) {
23                delete extObj[prop];
24                success = true;
25            }
26            if (prop in baseObj) {
27                delete baseObj[prop];
28                success = true;
29            }
30            return success;
31        },
32        ownKeys(_target) {
33            const baseKeys = Reflect.ownKeys(baseObj);
34            const extKeys = Reflect.ownKeys(extObj);
35            const extKeysSet = new Set(extKeys);
36            return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
37        },
38        defineProperty(_target, prop, desc) {
39            if (prop in extObj) {
40                delete extObj[prop];
41            }
42            Reflect.defineProperty(baseObj, prop, desc);
43            return true;
44        },
45        getOwnPropertyDescriptor(_target, prop) {
46            if (prop in extObj) {
47                return Reflect.getOwnPropertyDescriptor(extObj, prop);
48            }
49            else {
50                return Reflect.getOwnPropertyDescriptor(baseObj, prop);
51            }
52        },
53        has(_target, prop) {
54            return prop in extObj || prop in baseObj;
55        },
56    });
57}

We should remove these from the bundle

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the published effection bundle linked in the issue and trace where the Deno shim code is introduced. Confirm which bundling or packaging entry point produces it, then verify that a rebuilt bundle no longer contains the shown Deno shim code.

Written by the indexing model from the issue text.

Assessment

Tech stack
deno, typescript
Domain
build-system
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.