Skip to content

lavapack: Deprecate global,self as aliases for globalThis#461

Merged
legobeat merged 4 commits into
LavaMoat:mainfrom
legobeat:deprecate-globals-lavapack
Mar 22, 2023
Merged

lavapack: Deprecate global,self as aliases for globalThis#461
legobeat merged 4 commits into
LavaMoat:mainfrom
legobeat:deprecate-globals-lavapack

Conversation

@legobeat

Copy link
Copy Markdown
Collaborator

Follow-up to #459, which did the corresponding change in core.

@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from 54d1bf0 to 73c7a00 Compare February 28, 2023 09:44
@legobeat legobeat marked this pull request as ready for review February 28, 2023 11:56
@legobeat legobeat requested a review from a team February 28, 2023 11:56
@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from 73c7a00 to 6dac73d Compare March 7, 2023 06:27
@legobeat legobeat requested review from a team and removed request for a team March 7, 2023 06:27
@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from 6dac73d to 8fcecc4 Compare March 8, 2023 01:52
Comment thread packages/lavapack/src/runtime-cjs-template.js
@legobeat

legobeat commented Mar 8, 2023

Copy link
Copy Markdown
Collaborator Author

Updated to address potentially unaccounted for cases

@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from 8fcecc4 to dcd53b2 Compare March 8, 2023 02:07
Comment thread packages/lavapack/src/runtime-cjs-template.js Outdated
@legobeat legobeat requested a review from naugtur March 16, 2023 07:40
@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from dcd53b2 to 662f95a Compare March 16, 2023 07:40
@legobeat legobeat requested review from a team and kumavis March 16, 2023 07:40
@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from 9be0007 to 988a02c Compare March 21, 2023 23:53
Comment thread packages/lavapack/src/runtime-cjs-template.js Outdated
Comment thread packages/lavapack/src/runtime-cjs-template.js Outdated
Comment thread packages/lavapack/src/runtime-cjs-template.js Outdated

// identify the globalRef
const globalRef = (typeof globalThis !== 'undefined') ? globalThis : (typeof self !== 'undefined') ? self : (typeof global !== 'undefined') ? global : undefined
let globalRef = globalThis

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would fail under strict mode

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yappari ne

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amended to address this and other review comments.

Comment thread packages/lavapack/src/runtime-cjs-template.js Outdated
})

Object.defineProperty(globalThis, 'LavaPack', {value: LavaPack})
Object.defineProperty(globalRef, 'LavaPack', {value: LavaPack})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from 1f62c7f to 41db44d Compare March 22, 2023 03:13
@legobeat legobeat requested review from a team and kumavis March 22, 2023 03:14
@legobeat legobeat force-pushed the deprecate-globals-lavapack branch from 41db44d to 91e4363 Compare March 22, 2023 03:27
@legobeat legobeat merged commit ba3b50d into LavaMoat:main Mar 22, 2023
naugtur added a commit that referenced this pull request May 15, 2023
 - restrict engines.node to < 19.0.0 (#552)
 - Add `WebAssembly` scuttle globalThis exceptions - this is necessary as of Node.js 18 (#551)
 - Skip JSON files only for policy generation instead of limiting to js files. Current allowlist: cjs,js,mjs,ts (#474)
 - core/fix - remove console taming to that errors are logged to the console correctly (#493)
 - core: fix globalThis polyfill (#567)
 - Fix uncaught error when receiver is null in getPropertyDescriptorDeep (#463)
 - drop uneeded additionalOpts arg and migrate back into using scenario object (#471)
 - Wrap getters calling with try catch (#468)
 - Deprecate `global`,`self` as aliases for `globalThis` (#461)
@naugtur naugtur mentioned this pull request May 15, 2023
naugtur added a commit that referenced this pull request May 15, 2023
 - restrict engines.node to < 19.0.0 (#552)
 - Add `WebAssembly` scuttle globalThis exceptions - this is necessary as of Node.js 18 (#551)
 - Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
 - core/fix - remove console taming to that errors are logged to the console correctly (#493)
 - core: fix globalThis polyfill (#567)
 - Fix uncaught error when receiver is null in getPropertyDescriptorDeep (#463)
 - drop uneeded additionalOpts arg and migrate back into using scenario object (#471)
 - Wrap getters calling with try catch (#468)
 - Deprecate `global`,`self` as aliases for `globalThis` (#461)
naugtur added a commit that referenced this pull request May 15, 2023
 - fix: Restrict `engines.node` to < 19.0.0 (#552)
 - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
 - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
 - fix: Remove console taming so that errors are logged to the console correctly (#493)
 - fix: Fix globalThis polyfill (#567)
 - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
 - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
 - fix: Catch errors thrown when calling property getters (#468)
 - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
naugtur added a commit that referenced this pull request May 15, 2023
 - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
 - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
 - fix: Restrict `engines.node` to < 19.0.0 (#552)
 - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
 - fix: Remove console taming so that errors are logged to the console correctly (#493)
 - fix: Fix globalThis polyfill (#567)
 - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
 - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
 - fix: Catch errors thrown when calling property getters (#468)
legobeat added a commit that referenced this pull request May 15, 2023
- deps: lavamoat-core@14.0.0->14.1.0 (#576)
  - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
  - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
  - fix: Restrict `engines.node` to < 19.0.0 (#552)                                                - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
  - fix: Remove console taming so that errors are logged to the console correctly (#493)
  - fix: Fix globalThis polyfill (#567)                                                            - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
  - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
  - fix: Catch errors thrown when calling property getters (#468)
- deps: dependency maintenance bumps
  - json-stable-stringify@^1.0.1->^1.0.2
  - convert-source-map@^1.9.0->^2.0.0
  - espree@^7.3.0->^9.5.2
legobeat pushed a commit that referenced this pull request May 15, 2023
 - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
 - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
 - fix: Restrict `engines.node` to < 19.0.0 (#552)
 - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
 - fix: Remove console taming so that errors are logged to the console correctly (#493)
 - fix: Fix globalThis polyfill (#567)
 - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
 - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
 - fix: Catch errors thrown when calling property getters (#468)
legobeat added a commit that referenced this pull request May 15, 2023
- deps: lavamoat-core@14.0.0->14.1.0 (#576)
  - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
  - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
  - fix: Restrict `engines.node` to < 19.0.0 (#552)                                                - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
  - fix: Remove console taming so that errors are logged to the console correctly (#493)
  - fix: Fix globalThis polyfill (#567)                                                            - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
  - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
  - fix: Catch errors thrown when calling property getters (#468)
- deps: dependency maintenance bumps
  - json-stable-stringify@^1.0.1->^1.0.2
  - convert-source-map@^1.9.0->^2.0.0
  - espree@^7.3.0->^9.5.2
legobeat pushed a commit that referenced this pull request May 15, 2023
- change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
- change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
- fix: Restrict `engines.node` to < 19.0.0 (#552)
- fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
- fix: Remove console taming so that errors are logged to the console correctly (#493)
- fix: Fix globalThis polyfill (#567)
- fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
- fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
- fix: Catch errors thrown when calling property getters (#468)
- deps: remove object.fromentries, fromentries
legobeat added a commit that referenced this pull request May 15, 2023
- deps: lavamoat-core@14.0.0->14.1.0 (#576)
  - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
  - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
  - fix: Restrict `engines.node` to < 19.0.0 (#552)                                                - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
  - fix: Remove console taming so that errors are logged to the console correctly (#493)
  - fix: Fix globalThis polyfill (#567)                                                            - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
  - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
  - fix: Catch errors thrown when calling property getters (#468)
- deps: dependency maintenance bumps
  - json-stable-stringify@^1.0.1->^1.0.2
  - convert-source-map@^1.9.0->^2.0.0
  - espree@^7.3.0->^9.5.2
naugtur added a commit that referenced this pull request May 17, 2023
 - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
 - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
 - fix: Restrict `engines.node` to < 19.0.0 (#552)
 - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
 - fix: Remove console taming so that errors are logged to the console correctly (#493)
 - fix: Fix globalThis polyfill (#567)
 - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
 - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
 - fix: Catch errors thrown when calling property getters (#468)
legobeat added a commit that referenced this pull request May 17, 2023
- deps: lavamoat-core@14.0.0->14.1.0 (#576)
  - change: Policy generation now looks at .cjs, .mjs, .ts and .js files as opposed to only .js files (#474)
  - change: Deprecate `global`,`self` as aliases for `globalThis` (#461)
  - fix: Restrict `engines.node` to < 19.0.0 (#552)                                                - fix: Add `WebAssembly` to scuttle globalThis exceptions. This is necessary as of Node.js 18 (#551)
  - fix: Remove console taming so that errors are logged to the console correctly (#493)
  - fix: Fix globalThis polyfill (#567)                                                            - fix: Handle error when receiver is null in getPropertyDescriptorDeep (#463)
  - fix: Drop unnecessary additionalOpts arg and migrate back into using scenario object (#471)
  - fix: Catch errors thrown when calling property getters (#468)
- deps: dependency maintenance bumps
  - json-stable-stringify@^1.0.1->^1.0.2
  - convert-source-map@^1.9.0->^2.0.0
  - espree@^7.3.0->^9.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants