Skip to content

refactor(core&api)!: hide internal functions and reuse them in api.js & rename tauri module to primitives#7942

Merged
lucasfernog merged 18 commits intodevfrom
refactor/consistent-js-primtives
Oct 17, 2023
Merged

refactor(core&api)!: hide internal functions and reuse them in api.js & rename tauri module to primitives#7942
lucasfernog merged 18 commits intodevfrom
refactor/consistent-js-primtives

Conversation

@amrbashir
Copy link
Member

@amrbashir amrbashir commented Oct 2, 2023

ref: #7756

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

This PR aims to hide all internal functions and properties from the global window object and to window.__TAURI__.__INTERNALS__ and also changes @tauri-apps/api to use these functions instead of redefining the logic again.

Also renamed tauri module to primitives and removed the undocumented invoke re-export in the root module.

@amrbashir amrbashir requested a review from a team as a code owner October 2, 2023 22:47
@amrbashir amrbashir changed the title refactor(core&api): hide internal functions and resuse them in api.js refactor(core&api): hide internal functions & resuse them in api.js & rename tauri module to primitives Oct 2, 2023
@amrbashir amrbashir changed the title refactor(core&api): hide internal functions & resuse them in api.js & rename tauri module to primitives refactor(core&api)!: hide internal functions & resuse them in api.js & rename tauri module to primitives Oct 2, 2023
@lucasfernog
Copy link
Member

There's a reason we're not adding everything on TAURI: we replace that whole object if withGlobalTauri is set to true:

js: 'window.__TAURI__ = __TAURI_IIFE__'

I pushed some changes on your script, but that part of this PR can't be touched (unless we rename TAURI to something else for core scripts).

@amrbashir
Copy link
Member Author

I guess we need to change the place we store these internals, or change window.__TAURI__ = __TAURI_IIFE__ to window.__TAURI__ = { window.__TAURI__, ...(__TAURI_IIFE__) }

@socket-security
Copy link

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
vite 4.4.9 environment +24 213 MB vitebot
svelte 3.49.0...4.2.1 None +12/-0 5.37 MB svelte-admin
@tauri-apps/api 2.0.0-alpha.3...2.0.0-alpha.8 None +0/-0 128 kB tauri-apps-ci-user

🚮 Removed packages: @sveltejs/vite-plugin-svelte@1.0.1

@amrbashir
Copy link
Member Author

Moved to window.__TAURI_INTERNALS__

@lucasfernog lucasfernog changed the title refactor(core&api)!: hide internal functions & resuse them in api.js & rename tauri module to primitives refactor(core&api)!: hide internal functions and reuse them in api.js & rename tauri module to primitives Oct 17, 2023
@lucasfernog lucasfernog merged commit a63e71f into dev Oct 17, 2023
@lucasfernog lucasfernog deleted the refactor/consistent-js-primtives branch October 17, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 In audit

Development

Successfully merging this pull request may close these issues.

2 participants