Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019b7a6d-049e-7483-82da-de766df85583 Co-authored-by: Amp <amp@ampcode.com>
Migrated javascript/atoms/inject.js to TypeScript (inject.ts): - Converted bot.inject.cache functions (addElement, getElement) - Converted bot.inject functions (wrapValue, unwrapValue, executeScript, executeAsyncScript, wrapResponse, wrapError) - Replaced Closure utilities with native equivalents: - goog.utils.typeOf → custom typeOf function - goog.array.map → Array.prototype.map - goog.object.containsKey → 'in' operator check (hasKey) - goog.object.map/filter → Object iteration - goog.utils.now → Date.now() - goog.utils.partial → inline closure - goog.dom.NodeType.ELEMENT/DOCUMENT → constants 1/9 - Imported BotError, ErrorCode from './error' and stringify from './json' - Added proper TypeScript interfaces (JsonElement, JsonWindow, ResponseObject) - Added special handling in generate-shim.js for the dual namespace structure (bot.inject and bot.inject.cache) - All closure tests pass Amp-Thread-ID: https://ampcode.com/threads/T-019b7a6d-049e-7483-82da-e169bcb69aef Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This migrates the existing use of the Closure Library and Compiler to use TypeScript and
esbuild. This should allow us to continue working on the atoms in a more modern way, with a toolchain that is supported.