Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: allow none network related urls #715

Closed
frank-dspeed opened this issue Nov 9, 2022 · 1 comment
Closed

Proposal: allow none network related urls #715

frank-dspeed opened this issue Nov 9, 2022 · 1 comment

Comments

@frank-dspeed
Copy link

frank-dspeed commented Nov 9, 2022

Enable Direct referencing browser components via url specifers

moved from:

Proposal: consider url parsing to be more flexible about colons in the protocol part of a url enabled Dynamic -extension:// protocol resolved via serviceWorker

we can also name this:

  • Component based url specifiers
  • none network related extension specifiers
  • dynamic extension url handling extension://
  • dynamic url registration

Update

as i have writen tests for this i found out that we get near good results

// works
protocol: "node:"

// fails
protocol: "git+ssh@github:"

so its about allowing custom protocol specifiers with some additional signs

the most essential part of this is that a url that does not conforms to the networkProtocolName:// pattern gets parsed as is into

protocol and path propertys of the URL object as is without handling search parameters hash domain or anything

Proposal

Currently Fails

new URL("git+ssh@github.com:/me") // Fails

Expected

new URL("git+ssh@github.com:/me") 

{
  protocol: 'git+ssh@github.com',
  path: '/me'
}

<protocol ends with : >:<pathHashSearch>
/*
for compat if path starts with // and protocol is http<s> we strip it from path and 
take the domain and port as done before but if the protocol is unknown we strip into protocol path and path it to the serviceWorker or what ever implements the fetch load of the ECMAScript tc39 Spec
*/

fetch should use the ECMAScript resolve and loader implementations

so this is related to URL Object in tc39 and whatwg fetch and maybe whatwg url definition.

Why?

Browsers get more modular and even build custom for embedded devices this is at present complicated so the WinterCG got created to address needs of Web Interoperable Runtimes the most famouse of that runtimes is maybe Chromium or Webkit depends on the view. Both projects get now split into internal IPC Connected Components. it solves as referenced in the issue the problem of assertions that are not based on a file extension or a additional meta like

import me from 'git+ssh@github.com:whatwg/fetch'
// and not
import me from 'whatwg/fetch'  assert { type: "git+ssh@github" };

so it would be url serializeable

this is used in bundlers and runtimes already

import fs from 'node:fs'

i want to turn url into a specifier resolve algo for better interop on the long run with other browser external or internal components as we overall design browser more modular today

Chromium layer cake 2021

now as a coder and web author it would be beneficial if he could define ways to interact with them directly from the dom in a declarativ way without coding additional web components. As also existing interop between url specifiers in NodeJS and Browsers is not given as new URL does not handle none http related urls well.

use cases

Accessing Components

fetch needs to be enabled for example to accept raw graphics pipeline input which it is able to do at present i am passing a memory fileDescriptor to it and stream the body but at present i bound that in a hardcoded way and all other components do so

it would be beneficial if we could fetch raw body streams and post to them directly via a unified url protocol

this would even enable circumventing the ECMAScript context. internal

this also enables a whole set of stuff that we transpil at present before the run

<!-- Current snapshot of the webgpu rendering result at time the element got inserted into the dom -->
<!-- directly copyed internal no round trips direct mem copy -->
<img src="webgpu:0">
  • It will supply the fundamentals for linking the components cake layer into the dom via url specifiers
  • think about it as a dynamic unified version of the extensions:// protocol implemented in browsers

WinterOP

does enable again interop without transpilation with other ECMAScript Runtimes that are Web Inter Operable

see:
see:

so what i vote for is that we get it some how into any standard that is Winterop related that fetch should accept more then one : while taking only the last as protocol specifier

'me+go@da:lo.//mego' + '://me'
URL({
  protocol: 'me+go@da:lo.//mego',
  path: 'me'
})

as i think more about all the possible combinations with ports this needs some refinement it is not the only rule to take the last ":// " maybe some more rules are needed like if there are more then one double point. Bit i guess you all get why we need that
custom protocol specifiers are one of the most best interop features today to get the browser and other runtimes into diffrent handling.

the only alternate to custom protocol specifiers are searchParms and URL Hash which are by fare less readable then protocol specifiers like

import('ts:my-typescript')
import('npm:my-module')
import('local+json:my-module')

vs

import('my-typescript#ts')
import('my-typescript?ts=true')
import('my-module#npm')
import('my-module#local+json')

Allows implementation of custom protocol handlers

This enables dynamic protocol handler registration on the serviceWorker level which resolves the fetch requests.

@annevk
Copy link
Member

annevk commented Nov 9, 2022

I'm sorry, but we're not changing how URL schemes are parsed. Again, I strongly encourage you to read through https://whatwg.org/faq#adding-new-features.

@annevk annevk closed this as completed Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants