pulse-rb 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,23 +2,28 @@
2
2
  -- Wind UI adapter for Pulse components.
3
3
  -- Docs: footagesus.github.io/treehub-web/docs/windui
4
4
  -- Version: 1.6.64-fix (pinned)
5
-
6
- -- Executor loadstring() environments are sandboxed — each chunk has its OWN environment
7
- -- table, separate from _G. Global reads in this chunk go through getfenv(1), not _G.
8
- -- The compiler passes (_P, _PULSE_LAYOUT) as arguments.
9
- local _P, _PULSE_LAYOUT = ...
10
- if type(_P) == "table" then
5
+ --
6
+ -- Supports two load modes:
7
+ -- 1. Combined (rb publish): inlined into pulse.lua _PULSE_LAYOUT, Components, _Pages, Pulse
8
+ -- are already in scope as upvalues. publish.ts strips everything above [PULSE_INLINE_START].
9
+ -- 2. Separate (legacy): loaded via its own loadstring(_P, _PULSE_LAYOUT) call.
10
+ -- _P carries the bundle table; we spread it into the local env.
11
+ local _isSeparate = type(select(1,...)) == "table"
12
+ if _isSeparate then
13
+ local _P = select(1,...)
14
+ local _PULSE_LAYOUT = select(2,...) or {}
11
15
  local _env = (getfenv and getfenv(1)) or _ENV or _G
12
16
  for _k, _v in pairs(_P) do _env[_k] = _v end
13
17
  end
14
18
  _PULSE_LAYOUT = _PULSE_LAYOUT or {}
15
19
 
16
- -- Capture bundle table references as upvalues immediately so the startup block
17
- -- can access them without global lookups (which are environment-table-dependent
18
- -- in executor sandboxes and may fail in task.spawn callbacks).
19
- local _BundleComponents = type(_P) == "table" and _P.Components or {}
20
- local _BundlePages = type(_P) == "table" and _P._Pages or {}
21
- local _BundlePulse = type(_P) == "table" and _P.Pulse or Pulse
20
+ -- [PULSE_INLINE_START]
21
+ -- Everything below this marker is included verbatim when bundled inline.
22
+ -- In combined mode: Components, _Pages, Pulse are direct upvalues from runtime.lua.
23
+ -- In separate mode: they were spread into the local env by the block above.
24
+ local _BundleComponents = Components or {}
25
+ local _BundlePages = _Pages or {}
26
+ local _BundlePulse = Pulse or {}
22
27
 
23
28
  local _WINDUI_URL = "https://github.com/Footagesus/WindUI/releases/download/1.6.64-fix/main.lua"
24
29
  local _PULSE_LOGO = "https://pulse-rb.vercel.app/img/logo.svg"
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ var RB_VERSION, RB_HOME, IRONBREW2_DIR, IRONBREW2_REPO, ALWAYS_EXCLUDE, VALID_UI
56
56
  var init_constants = __esm({
57
57
  "src/constants.ts"() {
58
58
  init_cjs_shims();
59
- RB_VERSION = "1.4.1";
59
+ RB_VERSION = "1.4.2";
60
60
  RB_HOME = path.join(os.homedir(), ".rb");
61
61
  path.join(RB_HOME, "bin");
62
62
  IRONBREW2_DIR = path.join(RB_HOME, "ironbrew2");
@@ -1363,7 +1363,7 @@ end)
1363
1363
  if (opts.dev) parts.push(`,dev=true`);
1364
1364
  parts.push(`}
1365
1365
  `);
1366
- parts.push(`local _P=loadstring(game:HttpGet("${base}/bundle.lua"))()
1366
+ parts.push(`local _P=loadstring(game:HttpGet("${base}/pulse.lua"))(_PULSE_LAYOUT)
1367
1367
  `);
1368
1368
  if (opts.dev) {
1369
1369
  parts.push(`_PULSE_DEV = true
@@ -1388,8 +1388,6 @@ end)
1388
1388
  end
1389
1389
  `
1390
1390
  );
1391
- parts.push(`local _A=loadstring(game:HttpGet("${base}/adapters/${ui}.lua"))(_P,_PULSE_LAYOUT)
1392
- `);
1393
1391
  parts.push(`local signal,computed,defineComponent,on=_P.signal,_P.computed,_P.defineComponent,_P.on
1394
1392
  `);
1395
1393
  parts.push(`local toggle,slider,dropdown,multidropdown=_P.toggle,_P.slider,_P.dropdown,_P.multidropdown
@@ -2997,7 +2995,9 @@ async function cmdPublish(_args) {
2997
2995
  process.exit(1);
2998
2996
  }
2999
2997
  const bundleParts = [
3000
- `-- Pulse v${RB_VERSION} bundle (runtime + helpers)`,
2998
+ `-- Pulse v${RB_VERSION} (runtime + helpers + UI adapter)`,
2999
+ `-- Single loadstring \u2014 no executor sandbox split between runtime and UI.`,
3000
+ `local _PULSE_LAYOUT = ... or {}`,
3001
3001
  fs.readFileSync(runtimeFile, "utf8").trimEnd()
3002
3002
  ];
3003
3003
  if (fs.existsSync(helpersDir)) {
@@ -3006,21 +3006,22 @@ async function cmdPublish(_args) {
3006
3006
  bundleParts.push(fs.readFileSync(pathe.join(helpersDir, f), "utf8").trimEnd());
3007
3007
  }
3008
3008
  }
3009
+ const winduiPath = pathe.join(ADAPTERS, "windui.lua");
3010
+ if (fs.existsSync(winduiPath)) {
3011
+ const winduiSrc = fs.readFileSync(winduiPath, "utf8");
3012
+ const markerTag = "-- [PULSE_INLINE_START]";
3013
+ const markerIdx = winduiSrc.indexOf(markerTag);
3014
+ const winduiCore = markerIdx >= 0 ? winduiSrc.slice(markerIdx + markerTag.length).trimStart() : winduiSrc;
3015
+ bundleParts.push("-- [windui adapter inline]");
3016
+ bundleParts.push(winduiCore.trimEnd());
3017
+ }
3009
3018
  bundleParts.push(
3010
3019
  "return {signal=signal,computed=computed,defineComponent=defineComponent,on=on,toggle=toggle,slider=slider,dropdown=dropdown,multidropdown=multidropdown,button=button,keybind=keybind,label=label,separator=separator,groupbox=groupbox,definePage=definePage,Pulse=Pulse,Signal=Signal,Computed=Computed,Component=Component,Components=Components,Store=Store,PulseEvent=PulseEvent,_PulseGetChar=_PulseGetChar,_PulseGetHRP=_PulseGetHRP,_PulseGetHumanoid=_PulseGetHumanoid,_PulseGetAlive=_PulseGetAlive,_PulseRS=_PulseRS,_PulseUIS=_PulseUIS,_PulseDestroy=_PulseDestroy,_PULSE_DEFAULTS=_PULSE_DEFAULTS,_Pages=_Pages,_PulseRunHeartbeat=_PulseRunHeartbeat,_PulseRunRenderStepped=_PulseRunRenderStepped,_PulseRunStepped=_PulseRunStepped,_PulseRunCharAdded=_PulseRunCharAdded,_PulseRunCharRemoving=_PulseRunCharRemoving,_PulseRunInputBegan=_PulseRunInputBegan,_PulseRunInputEnded=_PulseRunInputEnded}"
3011
3020
  );
3012
3021
  const bundleContent = Buffer.from(bundleParts.join("\n") + "\n", "utf8");
3013
3022
  const uploads = [
3014
- { remote: `${VERSION_PATH}/bundle.lua`, content: bundleContent }
3023
+ { remote: `${VERSION_PATH}/pulse.lua`, content: bundleContent }
3015
3024
  ];
3016
- for (const adapter of ["windui"]) {
3017
- const p = pathe.join(ADAPTERS, `${adapter}.lua`);
3018
- if (!fs.existsSync(p)) continue;
3019
- uploads.push({
3020
- remote: `${VERSION_PATH}/adapters/${adapter}.lua`,
3021
- content: Buffer.from(fs.readFileSync(p, "utf8"), "utf8")
3022
- });
3023
- }
3024
3025
  pSection(`Uploading to R2 ${gray("(v" + RB_VERSION + " \xB7 " + uploads.length + " files)")}`);
3025
3026
  for (const { remote, content } of uploads) {
3026
3027
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulse-rb",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "rb CLI — Pulse framework build tool for Roblox script projects",
5
5
  "bin": {
6
6
  "rb": "./bin/rb.js"
package/pulse/runtime.lua CHANGED
@@ -186,17 +186,6 @@ local function Component(name)
186
186
  end)
187
187
  end
188
188
 
189
- -- Respawn listener (bound to connection tracker)
190
- function c:onRespawn(fn)
191
- local key = "__respawn_" .. name
192
- local existing = self._connections[key]
193
- if existing then
194
- pcall(function() existing:Disconnect() end)
195
- end
196
- self._connections[key] = game:GetService("Players").LocalPlayer
197
- .CharacterAdded:Connect(fn)
198
- end
199
-
200
189
  -- Lifecycle
201
190
  function c:mount()
202
191
  if self._mounted then return end