Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124226 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 4C8761A009C for ; Fri, 5 Jul 2024 05:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720157468; bh=xT5UVaHCFtT1owGoGQPPIXgm0h8rBddUwbqU4dHzOFY=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=GnL92gj7dCDXuZ9Lwd6SIs5GGFR+3mXR12pXlNJv0uIMDRUYTniMgES+QtCKdGE7R DtdcP5K7f17PS8OXqukxZKymwsK91sFZqjXC06Iu49MxRL2o7WHWzBqeYL3w09wwIH 7seq9Fwq4biOU0Ru5YBVKnkgXq2+4GFsBYAR86S5N5wI5VAW3Zs0d9p+U0COjXozL0 ngSsa96YG3dfm4ibz/MhD13LDxO7pc4sEYlCcRKOJaGF77/o6FsCZQdxp1OJjWupKU sunRX0hcYPxWQEuRM5JarlSOKyzzJazQPXeHiffoUBDXIYN7svR2oHf5k/qTcw3CqC IMfDC5AtaS9Zg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6F53A18007E for ; Fri, 5 Jul 2024 05:31:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 5 Jul 2024 05:31:06 +0000 (UTC) Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-651961563d6so11396867b3.0 for ; Thu, 04 Jul 2024 22:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20230601.gappssmtp.com; s=20230601; t=1720157383; x=1720762183; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=oPBZKyVyH4lA96id5NGefn7OqYws4oC+Nnj64XRsgsU=; b=ODTcAizc7GTSqrGTEOJF/7rQFV3WF7FH4NidSBnH39v/+2N3iC+qusqzD2KLlrOshy Q5jrz9HMlRKn+rrPAZQB+AM0KPEekBCshZWQym80yT+Ou+HVtLfIbsEkuSlYXP6WJmXX NEEuV8DxV/Y7GpDxMViXcWB3bicFalrvKqt+Fy9UOPEzVEqR7EZCobbPMALmonPMGC8T VAhaopPwWpDzGB7TzgfEX0UZgqKRYMs2yVkzCbNLR3uif3tcG4xcjtq2eM0e8amG5CED 0b2RF8Afl0qaxqujBURTsd9S1IHVKGrIDMwbGbEr94gAH+a9283HBcrs+KLniVqp4pPz Wzrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720157383; x=1720762183; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oPBZKyVyH4lA96id5NGefn7OqYws4oC+Nnj64XRsgsU=; b=StqaQ2zUJ/e/N+obcGnM7TZParvGeaST3EwntwlwaWJfAh5D8w0h979jRvYyxojXW/ nk2Brlxi3EtoMdTB4Kid/KhhBywvtGzhbQori3izZ5DK4PF9LjOTYAHRFrHJ4PMlH89s ALl5H4kxgJ0YoddfmfLJFn9Dw5zzTTz8PK1wDq9AoDQD1S5+Gy9K+CrqifjU7ZW3Z0uP KwYsFfT/+vKipEFvRIoSFe9cVgLaxtxkMzT69mP6Tclg5osLOvNoMsQJLxWD5LQLLkqb g8h4eZAGBngl8sHnwzd2dnLEkTmGv67mbLNpLL8fguVMlN0TOdFacnhVll+igc0jJJrU Dz0g== X-Gm-Message-State: AOJu0Yxz0rP/xlmg5mt9uq7aKELO7D8wC+WZ+angt0leuGBkvoWYNEdD dYJuKb7cn61S/py833yUcYdb4sac6QPEXVWaCFcwr1KGyDJJLvuOv+UbOqiuOic= X-Google-Smtp-Source: AGHT+IGRVMcc9zVq6S1yJDvYKfhRgh1scZEFCgwAfBp1cD0gKSBMuCbFMZDMmfRSdCUubbgVzCQfIg== X-Received: by 2002:a81:928f:0:b0:63b:ca6d:7bb8 with SMTP id 00721157ae682-652d5335039mr35621227b3.11.1720157383407; Thu, 04 Jul 2024 22:29:43 -0700 (PDT) Received: from smtpclient.apple (c-98-252-216-111.hsd1.ga.comcast.net. [98.252.216.111]) by smtp.gmail.com with ESMTPSA id 00721157ae682-652830e8979sm5437977b3.108.2024.07.04.22.29.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jul 2024 22:29:42 -0700 (PDT) Message-ID: <4F720A7A-B7DD-4B31-B0C9-6907419B53A5@newclarity.net> Content-Type: multipart/alternative; boundary="Apple-Mail=_8A21191A-F704-4962-83B6-835421E15069" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: [PHP-DEV] [PHP-Dev] Versioned Packagers (Iteration IV) Date: Fri, 5 Jul 2024 01:29:41 -0400 In-Reply-To: Cc: PHP internals To: Michael Morris References: <09559430-4477-4516-8D78-6F4071E1AA6C@newclarity.net> <0182F3D6-F464-477F-9029-A2D0A8B50C71@koalephant.com> <1AFD7AAE-8BEA-460D-88A8-15BB3D30A775@koalephant.com> <7B633CC7-C768-4852-A4D0-B252A04F7DE1@newclarity.net> <0E11F373-99DC-496E-9BBC-2F8688B9F66A@newclarity.net> X-Mailer: Apple Mail (2.3696.120.41.1.8) From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_8A21191A-F704-4962-83B6-835421E15069 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 4, 2024, at 9:16 PM, Michael Morris wrote: > On Wed, Jul 3, 2024 at 11:11=E2=80=AFPM Mike Schinkel = > wrote: > So I've had more time to mull this over, and some research, and I = think I have an approach. >=20 > First, instead of 'import', use 'require_module'. The parsing rules = for require_module differ from require how the file is parsed, a subject = for another time. Also, it's parallel to what is to follow. +1=20 > Speaking of new functions, let's start with these >=20 > spl_set_include_ini_map('importmap.ini'); > spl_set_include_json_map('importmap.json") Those are a mouthful!=20 > The json file is pretty much identical to the JavaScript importmaps. = The ini file looks like this >=20 > root =3D "/absolute/path/to/application/root" >=20 > [imports] > square =3D "./path/to/square.js" > circle =3D "./path/to/circle.js" > other/ =3D "./path/to/other/" >=20 > [scopes] > \A[square] =3D './path/to/square/in/namespace/A/a.js' I assume rather than `.js` you mean `.php` files in your example? Also, I am not following how these imports and scopes will relate to the = actual PHP code that would be affected/using packages. > Whichever format is used is a matter of personal preference. The file = can be, and likely should be, written by composer or some future package = manager. Part of me likes the flexibility of two formats. The other more = pragmatic part of me says stick with one format for fewer related bugs = and to reduce the effort to support it for internal code and by 3rd = parties. Unless it can be fully cached by opcache I would think it would need to = be the format that can be parsed the fastest, which could be binary like = a Protobuf file. > The root attribute in the map sets the root for all relative paths = given in the map. Are you saying that a publisher of a package would need to write the = absolute path to their `importmap.*` file. How will that work? Even for = a bespoke app Composer may not have enough access to the server to know = this, and 3rd party packages will definitely not know it for their = users. At least I don't think so. Also, at this point trying to keep track of all your ideas is = impossible, at least for me. Have you reconsidered putting it in a repo = or at least a Gist yet so it is easier to see the scope of your current = ideas about packages? -Mike --Apple-Mail=_8A21191A-F704-4962-83B6-835421E15069 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On = Jul 4, 2024, at 9:16 PM, Michael Morris <tendoaki@gmail.com> = wrote:
On Wed, Jul = 3, 2024 at 11:11=E2=80=AFPM Mike Schinkel <mike@newclarity.net>= wrote:
So I've had more time to mull this = over, and some research, and I think I have an = approach.

First, instead of 'import', use 'require_module'.  The = parsing rules for require_module differ from require how the file is = parsed, a subject for another time.  Also, it's parallel to what is = to follow.

+1 

Speaking of new functions, let's = start with these

  spl_set_include_ini_map('importmap.ini');
  = spl_set_include_json_map('importmap.json")

Those are a mouthful! 

The json file is pretty much identical to the JavaScript = importmaps. The ini file looks like this

  root =3D = "/absolute/path/to/application/root"

  [imports]
  = square =3D "./path/to/square.js"
  circle =3D = "./path/to/circle.js"
  other/ =3D = "./path/to/other/"

  [scopes]
  \A[square] =3D = './path/to/square/in/namespace/A/a.js'

I assume rather than `.js` you mean `.php` = files in your example?

Also, I am = not following how these imports and scopes will relate to the actual PHP = code that would be affected/using packages.

Whichever format = is used is a matter of personal preference. The file can be, and likely = should be, written by composer or some future package = manager.

Part of me likes the flexibility = of two formats. The other more pragmatic part of me says stick with one = format for fewer related bugs and to reduce the effort to support it for = internal code and by 3rd parties.

Unless it can be fully cached by opcache I would = think it would need to be the format that can be parsed the fastest, = which could be binary like a Protobuf file.

The root attribute in the map sets = the root for all relative paths given in the = map.

Are you saying that a publisher of a package would = need to write the absolute path to their `importmap.*` file. How will = that work?  Even for a bespoke app Composer may not have enough = access to the server to know this, and 3rd party packages will = definitely not know it for their users. At least I don't think = so.

Also, at this point trying to keep = track of all your ideas is impossible, at least for me. Have you = reconsidered putting it in a repo or at least a Gist yet so it is easier = to see the scope of your current ideas about packages?

-Mike

= --Apple-Mail=_8A21191A-F704-4962-83B6-835421E15069--