[javascript] Create @seleniumhq/atoms npm package from TypeScript atoms#17459
Open
AutomatedTester wants to merge 2 commits into
Open
[javascript] Create @seleniumhq/atoms npm package from TypeScript atoms#17459AutomatedTester wants to merge 2 commits into
AutomatedTester wants to merge 2 commits into
Conversation
Refactors the three TypeScript atoms (get-attribute, find-elements,
is-displayed) from IIFE closures to proper ES modules with export
default, then produces two compilation targets from the same sources:
- IIFE path (language bindings): ts_project --module commonjs →
cjs-to-iife.js → browser-injectable (function(){…return fn;})()
so py/rb/java/dotnet consumers are unchanged.
- npm path: ts_project --module esnext + declaration → dist/ published
as @seleniumhq/atoms with full TypeScript type declarations.
Key changes:
* Remove outer IIFE from all three atom .ts files; add export default.
* Add cjs-to-iife.js replacing strip-trailing-semicolon.js in the
IIFE pipeline. Strips CJS boilerplate and wraps the body in an IIFE
that returns the exported default function.
* Update wrap-as-global scripts to parse CJS-compiled input instead of
asserting (function () at the start.
* Switch BUILD.bazel from js_run_binary+tsc(--module none --outFile)
to ts_project for each atom, plus a new npm_package target.
* Add tsconfig.json (esnext, declaration) and tsconfig-cjs.json for
the two compilation paths.
* Add index.ts as the package entry point.
* Promote javascript/atoms/package.json to @seleniumhq/atoms v4.45.x.
* Add get_attribute_typescript and find-elements-typescript CJS module
targets to selenium-webdriver/lib/atoms/BUILD.bazel.
All 25 Python unit tests pass; //javascript/atoms:closure-test passes.
…roject targets When multiple ts_project targets share a single tsconfig with no files/include restriction, tsc compiles all .ts files for each target. On Windows, Bazel marks outputs read-only after the first action completes; parallel actions then fail with TS5033 EPERM trying to overwrite the same files. Give each per-atom ts_project its own tsconfig that lists only the one .ts file it is responsible for, eliminating the cross-target output collision.
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.
Refactors the three TypeScript atoms (get-attribute, find-elements, is-displayed) from IIFE closures to proper ES modules with export default, then produces two compilation targets from the same sources:
IIFE path (language bindings): ts_project --module commonjs → cjs-to-iife.js → browser-injectable (function(){…return fn;})() so py/rb/java/dotnet consumers are unchanged.
npm path: ts_project --module esnext + declaration → dist/ published as @seleniumhq/atoms with full TypeScript type declarations.
Key changes:
All 25 Python unit tests pass; //javascript/atoms:closure-test passes.
🔗 Related Issues
💥 What does this PR do?
🔧 Implementation Notes
🤖 AI assistance
💡 Additional Considerations
🔄 Types of changes