@jigging/jig 0.1.0-alpha.11 → 0.1.0-alpha.12

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.
@@ -1784,10 +1784,16 @@ function defineBinding(input) {
1784
1784
  return normalizeBinding(input, false);
1785
1785
  }
1786
1786
  function flowRef(path) {
1787
- return record({ kind: "flow", path: normalizeProjectPath(path, "Flow reference") });
1787
+ return record({
1788
+ kind: "flow",
1789
+ path: normalizeProjectPath(path, "Flow reference")
1790
+ });
1788
1791
  }
1789
1792
  function bindingRef(id) {
1790
- return record({ kind: "binding", id: validateLocalName(id, "Binding reference") });
1793
+ return record({
1794
+ kind: "binding",
1795
+ id: validateLocalName(id, "Binding reference")
1796
+ });
1791
1797
  }
1792
1798
  function normalizeBinding(input, canonical) {
1793
1799
  const captured = snapshotJsonObject(input, "Binding definition");
@@ -1800,7 +1806,12 @@ function normalizeBinding(input, canonical) {
1800
1806
  const packagePath = normalizeProjectPath(captured.package, "package");
1801
1807
  const settings = Object.hasOwn(captured, "settings") ? expectJsonObject(captured.settings, "settings") : emptyRecord();
1802
1808
  const slots = Object.hasOwn(captured, "slots") ? normalizeFlowSlots(captured.slots) : emptyRecord();
1803
- return record({ kind: "package", package: packagePath, settings, slots });
1809
+ return record({
1810
+ kind: "package",
1811
+ package: packagePath,
1812
+ settings,
1813
+ slots
1814
+ });
1804
1815
  }
1805
1816
  function normalizeFlowSlots(value) {
1806
1817
  const input = snapshotJsonObject(value, "slots");
@@ -240,65 +240,67 @@ async function build(request) {
240
240
  target: "bun",
241
241
  write: false,
242
242
  sourcemap: "none",
243
- plugins: [{
244
- name: "jig-closed-author-module",
245
- setup(builder) {
246
- builder.onResolve({ filter: /^jig-author:bridge$/ }, (arguments_) => {
247
- if (arguments_.kind !== "entry-point-build" || arguments_.importer !== "") {
243
+ plugins: [
244
+ {
245
+ name: "jig-closed-author-module",
246
+ setup(builder) {
247
+ builder.onResolve({ filter: /^jig-author:bridge$/ }, (arguments_) => {
248
+ if (arguments_.kind !== "entry-point-build" || arguments_.importer !== "") {
249
+ throw deniedImport(arguments_.path);
250
+ }
251
+ return { path: arguments_.path, namespace: "jig-author" };
252
+ });
253
+ builder.onResolve({ filter: /^jig-author:entry$/ }, (arguments_) => {
254
+ if (arguments_.kind !== "import-statement" || arguments_.importer !== "jig-author:bridge") {
255
+ throw deniedImport(arguments_.path);
256
+ }
257
+ return { path: request.entryProjectPath, namespace: "jig-project" };
258
+ });
259
+ builder.onResolve({ filter: /^jig-author:/ }, (arguments_) => {
248
260
  throw deniedImport(arguments_.path);
249
- }
250
- return { path: arguments_.path, namespace: "jig-author" };
251
- });
252
- builder.onResolve({ filter: /^jig-author:entry$/ }, (arguments_) => {
253
- if (arguments_.kind !== "import-statement" || arguments_.importer !== "jig-author:bridge") {
261
+ });
262
+ builder.onLoad({ filter: /^jig-author:bridge$/, namespace: "jig-author" }, () => ({
263
+ loader: "ts",
264
+ contents: bridge
265
+ }));
266
+ builder.onResolve({ filter: /^@jigging\/jig$/ }, (arguments_) => {
267
+ if (arguments_.kind !== "import-statement" || !modules.has(arguments_.importer)) {
268
+ throw deniedImport(arguments_.path);
269
+ }
270
+ return { path: "sdk", namespace: "jig-sealed" };
271
+ });
272
+ builder.onLoad({ filter: /^sdk$/, namespace: "jig-sealed" }, () => ({
273
+ loader: "js",
274
+ contents: sdkSource
275
+ }));
276
+ builder.onResolve({ filter: /.*/, namespace: "jig-sealed" }, (arguments_) => {
254
277
  throw deniedImport(arguments_.path);
255
- }
256
- return { path: request.entryProjectPath, namespace: "jig-project" };
257
- });
258
- builder.onResolve({ filter: /^jig-author:/ }, (arguments_) => {
259
- throw deniedImport(arguments_.path);
260
- });
261
- builder.onLoad({ filter: /^jig-author:bridge$/, namespace: "jig-author" }, () => ({
262
- loader: "ts",
263
- contents: bridge
264
- }));
265
- builder.onResolve({ filter: /^@jigging\/jig$/ }, (arguments_) => {
266
- if (arguments_.kind !== "import-statement" || !modules.has(arguments_.importer)) {
278
+ });
279
+ builder.onResolve({ filter: /.*/ }, (arguments_) => {
280
+ if (arguments_.kind !== "import-statement") {
281
+ throw deniedImport(`${arguments_.path} (${arguments_.kind} from ${arguments_.importer})`);
282
+ }
283
+ if (!modules.has(arguments_.importer)) {
284
+ throw deniedImport(`${arguments_.path} (from ${arguments_.importer})`);
285
+ }
286
+ const target = edges.get(`${arguments_.importer}\x00${arguments_.path}`);
287
+ if (target === undefined || !modules.has(target)) {
288
+ throw deniedImport(`${arguments_.path} (from ${arguments_.importer})`);
289
+ }
290
+ return { path: target, namespace: "jig-project" };
291
+ });
292
+ builder.onLoad({ filter: /.*/, namespace: "jig-project" }, (arguments_) => {
293
+ const module = modules.get(arguments_.path);
294
+ if (module === undefined)
295
+ return;
296
+ return { loader: "ts", contents: module.source };
297
+ });
298
+ builder.onResolve({ filter: /.*/, namespace: "jig-author" }, (arguments_) => {
267
299
  throw deniedImport(arguments_.path);
268
- }
269
- return { path: "sdk", namespace: "jig-sealed" };
270
- });
271
- builder.onLoad({ filter: /^sdk$/, namespace: "jig-sealed" }, () => ({
272
- loader: "js",
273
- contents: sdkSource
274
- }));
275
- builder.onResolve({ filter: /.*/, namespace: "jig-sealed" }, (arguments_) => {
276
- throw deniedImport(arguments_.path);
277
- });
278
- builder.onResolve({ filter: /.*/ }, (arguments_) => {
279
- if (arguments_.kind !== "import-statement") {
280
- throw deniedImport(`${arguments_.path} (${arguments_.kind} from ${arguments_.importer})`);
281
- }
282
- if (!modules.has(arguments_.importer)) {
283
- throw deniedImport(`${arguments_.path} (from ${arguments_.importer})`);
284
- }
285
- const target = edges.get(`${arguments_.importer}\x00${arguments_.path}`);
286
- if (target === undefined || !modules.has(target)) {
287
- throw deniedImport(`${arguments_.path} (from ${arguments_.importer})`);
288
- }
289
- return { path: target, namespace: "jig-project" };
290
- });
291
- builder.onLoad({ filter: /.*/, namespace: "jig-project" }, (arguments_) => {
292
- const module = modules.get(arguments_.path);
293
- if (module === undefined)
294
- return;
295
- return { loader: "ts", contents: module.source };
296
- });
297
- builder.onResolve({ filter: /.*/, namespace: "jig-author" }, (arguments_) => {
298
- throw deniedImport(arguments_.path);
299
- });
300
+ });
301
+ }
300
302
  }
301
- }]
303
+ ]
302
304
  });
303
305
  } catch (error) {
304
306
  const message = boundedMessage(error);
@@ -417,7 +419,10 @@ function boundedMessage(error) {
417
419
  let message;
418
420
  try {
419
421
  if (error instanceof AggregateError) {
420
- message = [error.message, ...error.errors.map((item) => item instanceof Error ? item.message : String(item))].join(": ");
422
+ message = [
423
+ error.message,
424
+ ...error.errors.map((item) => item instanceof Error ? item.message : String(item))
425
+ ].join(": ");
421
426
  } else {
422
427
  message = error instanceof Error ? error.message : String(error);
423
428
  }