@muze-nl/jsfs-solid 0.1.1 → 0.1.3

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.
package/dist/browser.js CHANGED
@@ -9091,8 +9091,9 @@
9091
9091
  // node_modules/@muze-nl/metro/src/everything.mjs
9092
9092
  var metro2 = Object.assign({}, metro_exports, {
9093
9093
  mw: {
9094
- jsonmw,
9095
- thrower: throwermw
9094
+ json: jsonmw,
9095
+ thrower: throwermw,
9096
+ getdata: getdatamw
9096
9097
  },
9097
9098
  api,
9098
9099
  jsonApi
@@ -14209,7 +14210,7 @@
14209
14210
  if (!options.prefixes["ldp"]) {
14210
14211
  options.prefixes["ldp"] = "http://www.w3.org/ns/ldp#";
14211
14212
  }
14212
- const context = src_default2(options);
14213
+ const context = src_default2.context(options);
14213
14214
  return async function oldmmw2(req, next) {
14214
14215
  if (!req.headers.get("Accept")) {
14215
14216
  req = req.with({
@@ -14236,8 +14237,30 @@
14236
14237
  }
14237
14238
  }
14238
14239
  let res = await next(req);
14240
+ if (res && isLinkedData(res.headers?.get("Content-Type"))) {
14241
+ let tempRes = res.clone();
14242
+ let body = await tempRes.text();
14243
+ try {
14244
+ let ld = context.parse(body, req.url, res.headers.get("Content-Type"));
14245
+ return res.with({
14246
+ body: ld
14247
+ });
14248
+ } catch (e) {
14249
+ }
14250
+ }
14251
+ return res;
14239
14252
  };
14240
14253
  }
14254
+ function isLinkedData(contentType) {
14255
+ const mimetypes = [
14256
+ "text/turtle",
14257
+ "application/n-quads",
14258
+ "text/x-nquads",
14259
+ "appliction/n-triples",
14260
+ "application/trig"
14261
+ ];
14262
+ return mimetypes.includes(contentType);
14263
+ }
14241
14264
 
14242
14265
  // node_modules/@muze-nl/metro-oldm/src/index.mjs
14243
14266
  globalThis.oldmmw = oldmmw;