@slicemachine/adapter-nuxt2 0.3.78-beta.8 → 0.3.78
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/_node_modules/@prismicio/simulator/dist/channel/ChannelNetwork.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/channel/ChannelNetwork.js.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/channel/ChannelReceiver.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/channel/ChannelReceiver.js.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/channel/errors.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/channel/errors.js.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/channel/messages.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/channel/messages.js.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/kit/SimulatorManager.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/kit/SimulatorManager.js.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/kit/domHelpers.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/kit/domHelpers.js.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/kit/messages.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/simulator/dist/kit/messages.js.map +1 -1
- package/dist/hooks/documentation-read.cjs.map +1 -1
- package/dist/hooks/documentation-read.js.map +1 -1
- package/dist/hooks/project-init.cjs.map +1 -1
- package/dist/hooks/project-init.js.map +1 -1
- package/dist/hooks/snippet-read.cjs.map +1 -1
- package/dist/hooks/snippet-read.js.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
- package/package.json +4 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelNetwork.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelNetwork.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { PortNotSetError, TooManyConcurrentRequestsError, RequestTimeoutError, ResponseError } from \"./errors.js\";\nimport { createRequestMessage, validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage, isSuccessResponseMessage } from \"./messages.js\";\nconst channelNetworkDefaultOptions = {\n debug: false,\n maximumRequestConcurrency: 20,\n defaultTimeout: 5e3,\n requestIDPrefix: \"channel-\"\n};\nclass ChannelNetwork {\n constructor(requestHandlers, options) {\n __publicField(this, \"requestHandlers\");\n __publicField(this, \"options\");\n __publicField(this, \"_port\", null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n __publicField(this, \"_pendingRequests\", /* @__PURE__ */ new Map());\n this.requestHandlers = requestHandlers;\n this.options = { ...channelNetworkDefaultOptions, ...options };\n }\n get port() {\n if (!this._port) {\n throw new PortNotSetError();\n }\n return this._port;\n }\n set port(port) {\n if (this._port) {\n this._port.onmessage = null;\n }\n this._port = port;\n if (this._port) {\n this._port.onmessage = this.onMessage.bind(this);\n }\n }\n createRequestMessage(type, data) {\n return createRequestMessage(type, data, this.options.requestIDPrefix);\n }\n async onMessage(event) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (!this.requestHandlers[message.type]) {\n this.postResponse(createErrorResponseMessage(message.requestID, void 0, 501));\n } else {\n try {\n const response = await this.requestHandlers[message.type](message, {\n success: createSuccessResponseMessage.bind(this, message.requestID),\n error: createErrorResponseMessage.bind(this, message.requestID)\n });\n this.postResponse(response);\n } catch (error) {\n this.postResponse(createErrorResponseMessage(message.requestID, error, 500));\n }\n }\n } else {\n if (!this._pendingRequests.has(message.requestID)) {\n console.error(`Unknown request ID received in response: ${JSON.stringify(message)}`);\n } else {\n this._pendingRequests.get(message.requestID)(message);\n this._pendingRequests.delete(message.requestID);\n }\n }\n } catch (error) {\n if (error instanceof TypeError) {\n console.warn(error.message);\n } else {\n throw error;\n }\n }\n }\n postRequest(request, postMessage = (request2) => this.port.postMessage(request2), options = {}) {\n if (this.options.debug) {\n console.debug(request);\n }\n if (this._pendingRequests.size >= this.options.maximumRequestConcurrency) {\n throw new TooManyConcurrentRequestsError(request);\n }\n return new Promise((resolve, reject) => {\n const requestTimeout = setTimeout(() => {\n if (this._pendingRequests.has(request.requestID)) {\n this._pendingRequests.delete(request.requestID);\n }\n reject(new RequestTimeoutError(request));\n }, options.timeout || this.options.defaultTimeout);\n this._pendingRequests.set(request.requestID, (response) => {\n clearTimeout(requestTimeout);\n isSuccessResponseMessage(response) ? resolve(response) : reject(new ResponseError(response));\n });\n postMessage(request);\n });\n }\n postResponse(response, postMessage = (response2) => this.port.postMessage(response2)) {\n if (this.options.debug) {\n console.debug(response);\n }\n postMessage(response);\n return response;\n }\n}\nexport {\n ChannelNetwork,\n channelNetworkDefaultOptions\n};\n//# sourceMappingURL=ChannelNetwork.js.map\n"],"names":["PortNotSetError","createRequestMessage","validateMessage","isRequestMessage","createErrorResponseMessage","createSuccessResponseMessage","TooManyConcurrentRequestsError","RequestTimeoutError","isSuccessResponseMessage","ResponseError"],"mappings":";;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAGK,MAAC,+BAA+B;AAAA,EACnC,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,SAAS;AAAA,cAClE,OAAOD,SAAAA,2BAA2B,KAAK,MAAM,QAAQ,SAAS;AAAA,YAC5E,CAAa;AACD,iBAAK,aAAa,QAAQ;AAAA,UAC3B,SAAQ,
|
|
1
|
+
{"version":3,"file":"ChannelNetwork.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelNetwork.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { PortNotSetError, TooManyConcurrentRequestsError, RequestTimeoutError, ResponseError } from \"./errors.js\";\nimport { createRequestMessage, validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage, isSuccessResponseMessage } from \"./messages.js\";\nconst channelNetworkDefaultOptions = {\n debug: false,\n maximumRequestConcurrency: 20,\n defaultTimeout: 5e3,\n requestIDPrefix: \"channel-\"\n};\nclass ChannelNetwork {\n constructor(requestHandlers, options) {\n __publicField(this, \"requestHandlers\");\n __publicField(this, \"options\");\n __publicField(this, \"_port\", null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n __publicField(this, \"_pendingRequests\", /* @__PURE__ */ new Map());\n this.requestHandlers = requestHandlers;\n this.options = { ...channelNetworkDefaultOptions, ...options };\n }\n get port() {\n if (!this._port) {\n throw new PortNotSetError();\n }\n return this._port;\n }\n set port(port) {\n if (this._port) {\n this._port.onmessage = null;\n }\n this._port = port;\n if (this._port) {\n this._port.onmessage = this.onMessage.bind(this);\n }\n }\n createRequestMessage(type, data) {\n return createRequestMessage(type, data, this.options.requestIDPrefix);\n }\n async onMessage(event) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (!this.requestHandlers[message.type]) {\n this.postResponse(createErrorResponseMessage(message.requestID, void 0, 501));\n } else {\n try {\n const response = await this.requestHandlers[message.type](message, {\n success: createSuccessResponseMessage.bind(this, message.requestID),\n error: createErrorResponseMessage.bind(this, message.requestID)\n });\n this.postResponse(response);\n } catch (error) {\n this.postResponse(createErrorResponseMessage(message.requestID, error, 500));\n }\n }\n } else {\n if (!this._pendingRequests.has(message.requestID)) {\n console.error(`Unknown request ID received in response: ${JSON.stringify(message)}`);\n } else {\n this._pendingRequests.get(message.requestID)(message);\n this._pendingRequests.delete(message.requestID);\n }\n }\n } catch (error) {\n if (error instanceof TypeError) {\n console.warn(error.message);\n } else {\n throw error;\n }\n }\n }\n postRequest(request, postMessage = (request2) => this.port.postMessage(request2), options = {}) {\n if (this.options.debug) {\n console.debug(request);\n }\n if (this._pendingRequests.size >= this.options.maximumRequestConcurrency) {\n throw new TooManyConcurrentRequestsError(request);\n }\n return new Promise((resolve, reject) => {\n const requestTimeout = setTimeout(() => {\n if (this._pendingRequests.has(request.requestID)) {\n this._pendingRequests.delete(request.requestID);\n }\n reject(new RequestTimeoutError(request));\n }, options.timeout || this.options.defaultTimeout);\n this._pendingRequests.set(request.requestID, (response) => {\n clearTimeout(requestTimeout);\n isSuccessResponseMessage(response) ? resolve(response) : reject(new ResponseError(response));\n });\n postMessage(request);\n });\n }\n postResponse(response, postMessage = (response2) => this.port.postMessage(response2)) {\n if (this.options.debug) {\n console.debug(response);\n }\n postMessage(response);\n return response;\n }\n}\nexport {\n ChannelNetwork,\n channelNetworkDefaultOptions\n};\n//# sourceMappingURL=ChannelNetwork.js.map\n"],"names":["PortNotSetError","createRequestMessage","validateMessage","isRequestMessage","createErrorResponseMessage","createSuccessResponseMessage","TooManyConcurrentRequestsError","RequestTimeoutError","isSuccessResponseMessage","ResponseError"],"mappings":";;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,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,eAAK,iBAAiB,OAAO,QAAQ,SAAS;AAAA,QAC/C;AACD,eAAO,IAAIC,OAAAA,oBAAoB,OAAO,CAAC;AAAA,MACxC,GAAE,QAAQ,WAAW,KAAK,QAAQ,cAAc;AACjD,WAAK,iBAAiB,IAAI,QAAQ,WAAW,CAAC,aAAa;AACzD,qBAAa,cAAc;AAC3BC,0CAAyB,QAAQ,IAAI,QAAQ,QAAQ,IAAI,OAAO,IAAIC,OAAAA,cAAc,QAAQ,CAAC;AAAA,MACnG,CAAO;AACD,kBAAY,OAAO;AAAA,IACzB,CAAK;AAAA,EACF;AAAA,EACD,aAAa,UAAU,cAAc,CAAC,cAAc,KAAK,KAAK,YAAY,SAAS,GAAG;AACpF,QAAI,KAAK,QAAQ,OAAO;AACtB,cAAQ,MAAM,QAAQ;AAAA,IACvB;AACD,gBAAY,QAAQ;AACpB,WAAO;AAAA,EACR;AACH;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelNetwork.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelNetwork.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { PortNotSetError, TooManyConcurrentRequestsError, RequestTimeoutError, ResponseError } from \"./errors.js\";\nimport { createRequestMessage, validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage, isSuccessResponseMessage } from \"./messages.js\";\nconst channelNetworkDefaultOptions = {\n debug: false,\n maximumRequestConcurrency: 20,\n defaultTimeout: 5e3,\n requestIDPrefix: \"channel-\"\n};\nclass ChannelNetwork {\n constructor(requestHandlers, options) {\n __publicField(this, \"requestHandlers\");\n __publicField(this, \"options\");\n __publicField(this, \"_port\", null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n __publicField(this, \"_pendingRequests\", /* @__PURE__ */ new Map());\n this.requestHandlers = requestHandlers;\n this.options = { ...channelNetworkDefaultOptions, ...options };\n }\n get port() {\n if (!this._port) {\n throw new PortNotSetError();\n }\n return this._port;\n }\n set port(port) {\n if (this._port) {\n this._port.onmessage = null;\n }\n this._port = port;\n if (this._port) {\n this._port.onmessage = this.onMessage.bind(this);\n }\n }\n createRequestMessage(type, data) {\n return createRequestMessage(type, data, this.options.requestIDPrefix);\n }\n async onMessage(event) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (!this.requestHandlers[message.type]) {\n this.postResponse(createErrorResponseMessage(message.requestID, void 0, 501));\n } else {\n try {\n const response = await this.requestHandlers[message.type](message, {\n success: createSuccessResponseMessage.bind(this, message.requestID),\n error: createErrorResponseMessage.bind(this, message.requestID)\n });\n this.postResponse(response);\n } catch (error) {\n this.postResponse(createErrorResponseMessage(message.requestID, error, 500));\n }\n }\n } else {\n if (!this._pendingRequests.has(message.requestID)) {\n console.error(`Unknown request ID received in response: ${JSON.stringify(message)}`);\n } else {\n this._pendingRequests.get(message.requestID)(message);\n this._pendingRequests.delete(message.requestID);\n }\n }\n } catch (error) {\n if (error instanceof TypeError) {\n console.warn(error.message);\n } else {\n throw error;\n }\n }\n }\n postRequest(request, postMessage = (request2) => this.port.postMessage(request2), options = {}) {\n if (this.options.debug) {\n console.debug(request);\n }\n if (this._pendingRequests.size >= this.options.maximumRequestConcurrency) {\n throw new TooManyConcurrentRequestsError(request);\n }\n return new Promise((resolve, reject) => {\n const requestTimeout = setTimeout(() => {\n if (this._pendingRequests.has(request.requestID)) {\n this._pendingRequests.delete(request.requestID);\n }\n reject(new RequestTimeoutError(request));\n }, options.timeout || this.options.defaultTimeout);\n this._pendingRequests.set(request.requestID, (response) => {\n clearTimeout(requestTimeout);\n isSuccessResponseMessage(response) ? resolve(response) : reject(new ResponseError(response));\n });\n postMessage(request);\n });\n }\n postResponse(response, postMessage = (response2) => this.port.postMessage(response2)) {\n if (this.options.debug) {\n console.debug(response);\n }\n postMessage(response);\n return response;\n }\n}\nexport {\n ChannelNetwork,\n channelNetworkDefaultOptions\n};\n//# sourceMappingURL=ChannelNetwork.js.map\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAGK,MAAC,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,2BAA2B;AAAA,EAC3B,gBAAgB;AAAA,EAChB,iBAAiB;AACnB;AACA,MAAM,eAAe;AAAA,EACnB,YAAY,iBAAiB,SAAS;AACpC,kBAAc,MAAM,iBAAiB;AACrC,kBAAc,MAAM,SAAS;AAC7B,kBAAc,MAAM,SAAS,IAAI;AAEjC,kBAAc,MAAM,oBAAoC,oBAAI,IAAK,CAAA;AACjE,SAAK,kBAAkB;AACvB,SAAK,UAAU,EAAE,GAAG,8BAA8B,GAAG,QAAO;AAAA,EAC7D;AAAA,EACD,IAAI,OAAO;AACT,QAAI,CAAC,KAAK,OAAO;AACf,YAAM,IAAI,gBAAe;AAAA,IAC1B;AACD,WAAO,KAAK;AAAA,EACb;AAAA,EACD,IAAI,KAAK,MAAM;AACb,QAAI,KAAK,OAAO;AACd,WAAK,MAAM,YAAY;AAAA,IACxB;AACD,SAAK,QAAQ;AACb,QAAI,KAAK,OAAO;AACd,WAAK,MAAM,YAAY,KAAK,UAAU,KAAK,IAAI;AAAA,IAChD;AAAA,EACF;AAAA,EACD,qBAAqB,MAAM,MAAM;AAC/B,WAAO,qBAAqB,MAAM,MAAM,KAAK,QAAQ,eAAe;AAAA,EACrE;AAAA,EACD,MAAM,UAAU,OAAO;AACrB,QAAI,KAAK,QAAQ,OAAO;AACtB,cAAQ,MAAM,MAAM,IAAI;AAAA,IACzB;AACD,QAAI;AACF,YAAM,UAAU,gBAAgB,MAAM,IAAI;AAC1C,UAAI,iBAAiB,OAAO,GAAG;AAC7B,YAAI,CAAC,KAAK,gBAAgB,QAAQ,IAAI,GAAG;AACvC,eAAK,aAAa,2BAA2B,QAAQ,WAAW,QAAQ,GAAG,CAAC;AAAA,QACtF,OAAe;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,KAAK,gBAAgB,QAAQ,IAAI,EAAE,SAAS;AAAA,cACjE,SAAS,6BAA6B,KAAK,MAAM,QAAQ,SAAS;AAAA,cAClE,OAAO,2BAA2B,KAAK,MAAM,QAAQ,SAAS;AAAA,YAC5E,CAAa;AACD,iBAAK,aAAa,QAAQ;AAAA,UAC3B,SAAQ,
|
|
1
|
+
{"version":3,"file":"ChannelNetwork.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelNetwork.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { PortNotSetError, TooManyConcurrentRequestsError, RequestTimeoutError, ResponseError } from \"./errors.js\";\nimport { createRequestMessage, validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage, isSuccessResponseMessage } from \"./messages.js\";\nconst channelNetworkDefaultOptions = {\n debug: false,\n maximumRequestConcurrency: 20,\n defaultTimeout: 5e3,\n requestIDPrefix: \"channel-\"\n};\nclass ChannelNetwork {\n constructor(requestHandlers, options) {\n __publicField(this, \"requestHandlers\");\n __publicField(this, \"options\");\n __publicField(this, \"_port\", null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n __publicField(this, \"_pendingRequests\", /* @__PURE__ */ new Map());\n this.requestHandlers = requestHandlers;\n this.options = { ...channelNetworkDefaultOptions, ...options };\n }\n get port() {\n if (!this._port) {\n throw new PortNotSetError();\n }\n return this._port;\n }\n set port(port) {\n if (this._port) {\n this._port.onmessage = null;\n }\n this._port = port;\n if (this._port) {\n this._port.onmessage = this.onMessage.bind(this);\n }\n }\n createRequestMessage(type, data) {\n return createRequestMessage(type, data, this.options.requestIDPrefix);\n }\n async onMessage(event) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (!this.requestHandlers[message.type]) {\n this.postResponse(createErrorResponseMessage(message.requestID, void 0, 501));\n } else {\n try {\n const response = await this.requestHandlers[message.type](message, {\n success: createSuccessResponseMessage.bind(this, message.requestID),\n error: createErrorResponseMessage.bind(this, message.requestID)\n });\n this.postResponse(response);\n } catch (error) {\n this.postResponse(createErrorResponseMessage(message.requestID, error, 500));\n }\n }\n } else {\n if (!this._pendingRequests.has(message.requestID)) {\n console.error(`Unknown request ID received in response: ${JSON.stringify(message)}`);\n } else {\n this._pendingRequests.get(message.requestID)(message);\n this._pendingRequests.delete(message.requestID);\n }\n }\n } catch (error) {\n if (error instanceof TypeError) {\n console.warn(error.message);\n } else {\n throw error;\n }\n }\n }\n postRequest(request, postMessage = (request2) => this.port.postMessage(request2), options = {}) {\n if (this.options.debug) {\n console.debug(request);\n }\n if (this._pendingRequests.size >= this.options.maximumRequestConcurrency) {\n throw new TooManyConcurrentRequestsError(request);\n }\n return new Promise((resolve, reject) => {\n const requestTimeout = setTimeout(() => {\n if (this._pendingRequests.has(request.requestID)) {\n this._pendingRequests.delete(request.requestID);\n }\n reject(new RequestTimeoutError(request));\n }, options.timeout || this.options.defaultTimeout);\n this._pendingRequests.set(request.requestID, (response) => {\n clearTimeout(requestTimeout);\n isSuccessResponseMessage(response) ? resolve(response) : reject(new ResponseError(response));\n });\n postMessage(request);\n });\n }\n postResponse(response, postMessage = (response2) => this.port.postMessage(response2)) {\n if (this.options.debug) {\n console.debug(response);\n }\n postMessage(response);\n return response;\n }\n}\nexport {\n ChannelNetwork,\n channelNetworkDefaultOptions\n};\n//# sourceMappingURL=ChannelNetwork.js.map\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAGK,MAAC,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,2BAA2B;AAAA,EAC3B,gBAAgB;AAAA,EAChB,iBAAiB;AACnB;AACA,MAAM,eAAe;AAAA,EACnB,YAAY,iBAAiB,SAAS;AACpC,kBAAc,MAAM,iBAAiB;AACrC,kBAAc,MAAM,SAAS;AAC7B,kBAAc,MAAM,SAAS,IAAI;AAEjC,kBAAc,MAAM,oBAAoC,oBAAI,IAAK,CAAA;AACjE,SAAK,kBAAkB;AACvB,SAAK,UAAU,EAAE,GAAG,8BAA8B,GAAG,QAAO;AAAA,EAC7D;AAAA,EACD,IAAI,OAAO;AACT,QAAI,CAAC,KAAK,OAAO;AACf,YAAM,IAAI,gBAAe;AAAA,IAC1B;AACD,WAAO,KAAK;AAAA,EACb;AAAA,EACD,IAAI,KAAK,MAAM;AACb,QAAI,KAAK,OAAO;AACd,WAAK,MAAM,YAAY;AAAA,IACxB;AACD,SAAK,QAAQ;AACb,QAAI,KAAK,OAAO;AACd,WAAK,MAAM,YAAY,KAAK,UAAU,KAAK,IAAI;AAAA,IAChD;AAAA,EACF;AAAA,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AAI;AAC9F,QAAI,KAAK,QAAQ,OAAO;AACtB,cAAQ,MAAM,OAAO;AAAA,IACtB;AACD,QAAI,KAAK,iBAAiB,QAAQ,KAAK,QAAQ,2BAA2B;AACxE,YAAM,IAAI,+BAA+B,OAAO;AAAA,IACjD;AACD,WAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,YAAM,iBAAiB,WAAW,MAAM;AACtC,YAAI,KAAK,iBAAiB,IAAI,QAAQ,SAAS,GAAG;AAChD,eAAK,iBAAiB,OAAO,QAAQ,SAAS;AAAA,QAC/C;AACD,eAAO,IAAI,oBAAoB,OAAO,CAAC;AAAA,MACxC,GAAE,QAAQ,WAAW,KAAK,QAAQ,cAAc;AACjD,WAAK,iBAAiB,IAAI,QAAQ,WAAW,CAAC,aAAa;AACzD,qBAAa,cAAc;AAC3B,iCAAyB,QAAQ,IAAI,QAAQ,QAAQ,IAAI,OAAO,IAAI,cAAc,QAAQ,CAAC;AAAA,MACnG,CAAO;AACD,kBAAY,OAAO;AAAA,IACzB,CAAK;AAAA,EACF;AAAA,EACD,aAAa,UAAU,cAAc,CAAC,cAAc,KAAK,KAAK,YAAY,SAAS,GAAG;AACpF,QAAI,KAAK,QAAQ,OAAO;AACtB,cAAQ,MAAM,QAAQ;AAAA,IACvB;AACD,gBAAY,QAAQ;AACpB,WAAO;AAAA,EACR;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelReceiver.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelReceiver.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { InternalReceiverRequestType, InternalEmitterRequestType } from \"./types.js\";\nimport { NotReadyError } from \"./errors.js\";\nimport { ChannelNetwork } from \"./ChannelNetwork.js\";\nimport { validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage } from \"./messages.js\";\nconst channelReceiverDefaultOptions = {\n readyTimeout: 2e4,\n requestIDPrefix: \"receiver-\"\n};\nclass ChannelReceiver extends ChannelNetwork {\n constructor(requestHandlers, options) {\n super(requestHandlers, { ...channelReceiverDefaultOptions, ...options });\n __publicField(this, \"_ready\", false);\n window.addEventListener(\"message\", (event) => {\n this._onPublicMessage(event);\n });\n }\n /**\n * Tells the emitter that receiver is ready\n */\n async ready() {\n if (window.parent === window) {\n throw new Error(\"Receiver is currently not embedded as an iframe\");\n }\n this._ready = false;\n const request = this.createRequestMessage(InternalReceiverRequestType.Ready, void 0);\n const response = await this.postRequest(request, (request2) => {\n window.parent.postMessage(request2, \"*\");\n }, {\n timeout: this.options.readyTimeout\n });\n this._ready = true;\n return response;\n }\n /**\n * Handles public messages\n */\n _onPublicMessage(event) {\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n switch (message.type) {\n case InternalEmitterRequestType.Connect:\n this.port = event.ports[0];\n const { data } = message;\n this.options = {\n ...this.options,\n ...data,\n // Ensure core options remain the same\n debug: this.options.debug,\n requestIDPrefix: this.options.requestIDPrefix,\n readyTimeout: this.options.readyTimeout\n };\n const response = createSuccessResponseMessage(message.requestID, void 0);\n this.postResponse(response);\n break;\n default:\n this.postResponse(createErrorResponseMessage(message.requestID, void 0), (response2) => {\n event.source.postMessage(response2, event.origin);\n });\n break;\n }\n } else {\n if (!this._ready) {\n this.onMessage(event);\n }\n }\n } catch (error) {\n if (error instanceof TypeError)\n ;\n else {\n throw error;\n }\n }\n }\n postFormattedRequest(type, data, options = {}) {\n if (!this._ready) {\n throw new NotReadyError(\"Receiver is not ready, use `ChannelReceiver.ready()` first\");\n }\n return this.postRequest(this.createRequestMessage(type, data), void 0, options);\n }\n}\nexport {\n ChannelReceiver,\n channelReceiverDefaultOptions\n};\n//# sourceMappingURL=ChannelReceiver.js.map\n"],"names":["ChannelNetwork","InternalReceiverRequestType","validateMessage","isRequestMessage","InternalEmitterRequestType","createSuccessResponseMessage","createErrorResponseMessage","NotReadyError"],"mappings":";;;;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAKK,MAAC,gCAAgC;AAAA,EACpC,cAAc;AAAA,EACd,iBAAiB;AACnB;AACA,MAAM,wBAAwBA,eAAAA,eAAe;AAAA,EAC3C,YAAY,iBAAiB,SAAS;AACpC,UAAM,iBAAiB,EAAE,GAAG,+BAA+B,GAAG,QAAS,CAAA;AACvE,kBAAc,MAAM,UAAU,KAAK;AACnC,WAAO,iBAAiB,WAAW,CAAC,UAAU;AAC5C,WAAK,iBAAiB,KAAK;AAAA,IACjC,CAAK;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAID,MAAM,QAAQ;AACZ,QAAI,OAAO,WAAW,QAAQ;AAC5B,YAAM,IAAI,MAAM,iDAAiD;AAAA,IAClE;AACD,SAAK,SAAS;AACd,UAAM,UAAU,KAAK,qBAAqBC,MAA2B,4BAAC,OAAO,MAAM;AACnF,UAAM,WAAW,MAAM,KAAK,YAAY,SAAS,CAAC,aAAa;AAC7D,aAAO,OAAO,YAAY,UAAU,GAAG;AAAA,IAC7C,GAAO;AAAA,MACD,SAAS,KAAK,QAAQ;AAAA,IAC5B,CAAK;AACD,SAAK,SAAS;AACd,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA,EAID,iBAAiB,OAAO;AACtB,QAAI;AACF,YAAM,UAAUC,SAAAA,gBAAgB,MAAM,IAAI;AAC1C,UAAIC,SAAAA,iBAAiB,OAAO,GAAG;AAC7B,YAAI,KAAK,QAAQ,OAAO;AACtB,kBAAQ,MAAM,MAAM,IAAI;AAAA,QACzB;AACD,gBAAQ,QAAQ,MAAI;AAAA,UAClB,KAAKC,MAA0B,2BAAC;AAC9B,iBAAK,OAAO,MAAM,MAAM,CAAC;AACzB,kBAAM,EAAE,KAAM,IAAG;AACjB,iBAAK,UAAU;AAAA,cACb,GAAG,KAAK;AAAA,cACR,GAAG;AAAA;AAAA,cAEH,OAAO,KAAK,QAAQ;AAAA,cACpB,iBAAiB,KAAK,QAAQ;AAAA,cAC9B,cAAc,KAAK,QAAQ;AAAA,YACzC;AACY,kBAAM,WAAWC,SAAAA,6BAA6B,QAAQ,WAAW,MAAM;AACvE,iBAAK,aAAa,QAAQ;AAC1B;AAAA,UACF;AACE,iBAAK,aAAaC,SAAAA,2BAA2B,QAAQ,WAAW,MAAM,GAAG,CAAC,cAAc;AACtF,oBAAM,OAAO,YAAY,WAAW,MAAM,MAAM;AAAA,YAC9D,CAAa;AACD;AAAA,QACH;AAAA,MACT,OAAa;AACL,YAAI,CAAC,KAAK,QAAQ;AAChB,eAAK,UAAU,KAAK;AAAA,QACrB;AAAA,MACF;AAAA,IACF,SAAQ,
|
|
1
|
+
{"version":3,"file":"ChannelReceiver.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelReceiver.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { InternalReceiverRequestType, InternalEmitterRequestType } from \"./types.js\";\nimport { NotReadyError } from \"./errors.js\";\nimport { ChannelNetwork } from \"./ChannelNetwork.js\";\nimport { validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage } from \"./messages.js\";\nconst channelReceiverDefaultOptions = {\n readyTimeout: 2e4,\n requestIDPrefix: \"receiver-\"\n};\nclass ChannelReceiver extends ChannelNetwork {\n constructor(requestHandlers, options) {\n super(requestHandlers, { ...channelReceiverDefaultOptions, ...options });\n __publicField(this, \"_ready\", false);\n window.addEventListener(\"message\", (event) => {\n this._onPublicMessage(event);\n });\n }\n /**\n * Tells the emitter that receiver is ready\n */\n async ready() {\n if (window.parent === window) {\n throw new Error(\"Receiver is currently not embedded as an iframe\");\n }\n this._ready = false;\n const request = this.createRequestMessage(InternalReceiverRequestType.Ready, void 0);\n const response = await this.postRequest(request, (request2) => {\n window.parent.postMessage(request2, \"*\");\n }, {\n timeout: this.options.readyTimeout\n });\n this._ready = true;\n return response;\n }\n /**\n * Handles public messages\n */\n _onPublicMessage(event) {\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n switch (message.type) {\n case InternalEmitterRequestType.Connect:\n this.port = event.ports[0];\n const { data } = message;\n this.options = {\n ...this.options,\n ...data,\n // Ensure core options remain the same\n debug: this.options.debug,\n requestIDPrefix: this.options.requestIDPrefix,\n readyTimeout: this.options.readyTimeout\n };\n const response = createSuccessResponseMessage(message.requestID, void 0);\n this.postResponse(response);\n break;\n default:\n this.postResponse(createErrorResponseMessage(message.requestID, void 0), (response2) => {\n event.source.postMessage(response2, event.origin);\n });\n break;\n }\n } else {\n if (!this._ready) {\n this.onMessage(event);\n }\n }\n } catch (error) {\n if (error instanceof TypeError)\n ;\n else {\n throw error;\n }\n }\n }\n postFormattedRequest(type, data, options = {}) {\n if (!this._ready) {\n throw new NotReadyError(\"Receiver is not ready, use `ChannelReceiver.ready()` first\");\n }\n return this.postRequest(this.createRequestMessage(type, data), void 0, options);\n }\n}\nexport {\n ChannelReceiver,\n channelReceiverDefaultOptions\n};\n//# sourceMappingURL=ChannelReceiver.js.map\n"],"names":["ChannelNetwork","InternalReceiverRequestType","validateMessage","isRequestMessage","InternalEmitterRequestType","createSuccessResponseMessage","createErrorResponseMessage","NotReadyError"],"mappings":";;;;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAKK,MAAC,gCAAgC;AAAA,EACpC,cAAc;AAAA,EACd,iBAAiB;AACnB;AACA,MAAM,wBAAwBA,eAAAA,eAAe;AAAA,EAC3C,YAAY,iBAAiB,SAAS;AACpC,UAAM,iBAAiB,EAAE,GAAG,+BAA+B,GAAG,QAAS,CAAA;AACvE,kBAAc,MAAM,UAAU,KAAK;AACnC,WAAO,iBAAiB,WAAW,CAAC,UAAU;AAC5C,WAAK,iBAAiB,KAAK;AAAA,IACjC,CAAK;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAID,MAAM,QAAQ;AACZ,QAAI,OAAO,WAAW,QAAQ;AAC5B,YAAM,IAAI,MAAM,iDAAiD;AAAA,IAClE;AACD,SAAK,SAAS;AACd,UAAM,UAAU,KAAK,qBAAqBC,MAA2B,4BAAC,OAAO,MAAM;AACnF,UAAM,WAAW,MAAM,KAAK,YAAY,SAAS,CAAC,aAAa;AAC7D,aAAO,OAAO,YAAY,UAAU,GAAG;AAAA,IAC7C,GAAO;AAAA,MACD,SAAS,KAAK,QAAQ;AAAA,IAC5B,CAAK;AACD,SAAK,SAAS;AACd,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA,EAID,iBAAiB,OAAO;AACtB,QAAI;AACF,YAAM,UAAUC,SAAAA,gBAAgB,MAAM,IAAI;AAC1C,UAAIC,SAAAA,iBAAiB,OAAO,GAAG;AAC7B,YAAI,KAAK,QAAQ,OAAO;AACtB,kBAAQ,MAAM,MAAM,IAAI;AAAA,QACzB;AACD,gBAAQ,QAAQ,MAAI;AAAA,UAClB,KAAKC,MAA0B,2BAAC;AAC9B,iBAAK,OAAO,MAAM,MAAM,CAAC;AACzB,kBAAM,EAAE,KAAM,IAAG;AACjB,iBAAK,UAAU;AAAA,cACb,GAAG,KAAK;AAAA,cACR,GAAG;AAAA;AAAA,cAEH,OAAO,KAAK,QAAQ;AAAA,cACpB,iBAAiB,KAAK,QAAQ;AAAA,cAC9B,cAAc,KAAK,QAAQ;AAAA,YACzC;AACY,kBAAM,WAAWC,SAAAA,6BAA6B,QAAQ,WAAW,MAAM;AACvE,iBAAK,aAAa,QAAQ;AAC1B;AAAA,UACF;AACE,iBAAK,aAAaC,SAAAA,2BAA2B,QAAQ,WAAW,MAAM,GAAG,CAAC,cAAc;AACtF,oBAAM,OAAO,YAAY,WAAW,MAAM,MAAM;AAAA,YAC9D,CAAa;AACD;AAAA,QACH;AAAA,MACT,OAAa;AACL,YAAI,CAAC,KAAK,QAAQ;AAChB,eAAK,UAAU,KAAK;AAAA,QACrB;AAAA,MACF;AAAA,IACF,SAAQ,OAAO;AACd,UAAI,iBAAiB;AACnB;AAAA,WACG;AACH,cAAM;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAAA,EACD,qBAAqB,MAAM,MAAM,UAAU,CAAA,GAAI;AAC7C,QAAI,CAAC,KAAK,QAAQ;AAChB,YAAM,IAAIC,OAAAA,cAAc,4DAA4D;AAAA,IACrF;AACD,WAAO,KAAK,YAAY,KAAK,qBAAqB,MAAM,IAAI,GAAG,QAAQ,OAAO;AAAA,EAC/E;AACH;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelReceiver.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelReceiver.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { InternalReceiverRequestType, InternalEmitterRequestType } from \"./types.js\";\nimport { NotReadyError } from \"./errors.js\";\nimport { ChannelNetwork } from \"./ChannelNetwork.js\";\nimport { validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage } from \"./messages.js\";\nconst channelReceiverDefaultOptions = {\n readyTimeout: 2e4,\n requestIDPrefix: \"receiver-\"\n};\nclass ChannelReceiver extends ChannelNetwork {\n constructor(requestHandlers, options) {\n super(requestHandlers, { ...channelReceiverDefaultOptions, ...options });\n __publicField(this, \"_ready\", false);\n window.addEventListener(\"message\", (event) => {\n this._onPublicMessage(event);\n });\n }\n /**\n * Tells the emitter that receiver is ready\n */\n async ready() {\n if (window.parent === window) {\n throw new Error(\"Receiver is currently not embedded as an iframe\");\n }\n this._ready = false;\n const request = this.createRequestMessage(InternalReceiverRequestType.Ready, void 0);\n const response = await this.postRequest(request, (request2) => {\n window.parent.postMessage(request2, \"*\");\n }, {\n timeout: this.options.readyTimeout\n });\n this._ready = true;\n return response;\n }\n /**\n * Handles public messages\n */\n _onPublicMessage(event) {\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n switch (message.type) {\n case InternalEmitterRequestType.Connect:\n this.port = event.ports[0];\n const { data } = message;\n this.options = {\n ...this.options,\n ...data,\n // Ensure core options remain the same\n debug: this.options.debug,\n requestIDPrefix: this.options.requestIDPrefix,\n readyTimeout: this.options.readyTimeout\n };\n const response = createSuccessResponseMessage(message.requestID, void 0);\n this.postResponse(response);\n break;\n default:\n this.postResponse(createErrorResponseMessage(message.requestID, void 0), (response2) => {\n event.source.postMessage(response2, event.origin);\n });\n break;\n }\n } else {\n if (!this._ready) {\n this.onMessage(event);\n }\n }\n } catch (error) {\n if (error instanceof TypeError)\n ;\n else {\n throw error;\n }\n }\n }\n postFormattedRequest(type, data, options = {}) {\n if (!this._ready) {\n throw new NotReadyError(\"Receiver is not ready, use `ChannelReceiver.ready()` first\");\n }\n return this.postRequest(this.createRequestMessage(type, data), void 0, options);\n }\n}\nexport {\n ChannelReceiver,\n channelReceiverDefaultOptions\n};\n//# sourceMappingURL=ChannelReceiver.js.map\n"],"names":[],"mappings":";;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAKK,MAAC,gCAAgC;AAAA,EACpC,cAAc;AAAA,EACd,iBAAiB;AACnB;AACA,MAAM,wBAAwB,eAAe;AAAA,EAC3C,YAAY,iBAAiB,SAAS;AACpC,UAAM,iBAAiB,EAAE,GAAG,+BAA+B,GAAG,QAAS,CAAA;AACvE,kBAAc,MAAM,UAAU,KAAK;AACnC,WAAO,iBAAiB,WAAW,CAAC,UAAU;AAC5C,WAAK,iBAAiB,KAAK;AAAA,IACjC,CAAK;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAID,MAAM,QAAQ;AACZ,QAAI,OAAO,WAAW,QAAQ;AAC5B,YAAM,IAAI,MAAM,iDAAiD;AAAA,IAClE;AACD,SAAK,SAAS;AACd,UAAM,UAAU,KAAK,qBAAqB,4BAA4B,OAAO,MAAM;AACnF,UAAM,WAAW,MAAM,KAAK,YAAY,SAAS,CAAC,aAAa;AAC7D,aAAO,OAAO,YAAY,UAAU,GAAG;AAAA,IAC7C,GAAO;AAAA,MACD,SAAS,KAAK,QAAQ;AAAA,IAC5B,CAAK;AACD,SAAK,SAAS;AACd,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA,EAID,iBAAiB,OAAO;AACtB,QAAI;AACF,YAAM,UAAU,gBAAgB,MAAM,IAAI;AAC1C,UAAI,iBAAiB,OAAO,GAAG;AAC7B,YAAI,KAAK,QAAQ,OAAO;AACtB,kBAAQ,MAAM,MAAM,IAAI;AAAA,QACzB;AACD,gBAAQ,QAAQ,MAAI;AAAA,UAClB,KAAK,2BAA2B;AAC9B,iBAAK,OAAO,MAAM,MAAM,CAAC;AACzB,kBAAM,EAAE,KAAM,IAAG;AACjB,iBAAK,UAAU;AAAA,cACb,GAAG,KAAK;AAAA,cACR,GAAG;AAAA;AAAA,cAEH,OAAO,KAAK,QAAQ;AAAA,cACpB,iBAAiB,KAAK,QAAQ;AAAA,cAC9B,cAAc,KAAK,QAAQ;AAAA,YACzC;AACY,kBAAM,WAAW,6BAA6B,QAAQ,WAAW,MAAM;AACvE,iBAAK,aAAa,QAAQ;AAC1B;AAAA,UACF;AACE,iBAAK,aAAa,2BAA2B,QAAQ,WAAW,MAAM,GAAG,CAAC,cAAc;AACtF,oBAAM,OAAO,YAAY,WAAW,MAAM,MAAM;AAAA,YAC9D,CAAa;AACD;AAAA,QACH;AAAA,MACT,OAAa;AACL,YAAI,CAAC,KAAK,QAAQ;AAChB,eAAK,UAAU,KAAK;AAAA,QACrB;AAAA,MACF;AAAA,IACF,SAAQ,
|
|
1
|
+
{"version":3,"file":"ChannelReceiver.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/ChannelReceiver.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { InternalReceiverRequestType, InternalEmitterRequestType } from \"./types.js\";\nimport { NotReadyError } from \"./errors.js\";\nimport { ChannelNetwork } from \"./ChannelNetwork.js\";\nimport { validateMessage, isRequestMessage, createErrorResponseMessage, createSuccessResponseMessage } from \"./messages.js\";\nconst channelReceiverDefaultOptions = {\n readyTimeout: 2e4,\n requestIDPrefix: \"receiver-\"\n};\nclass ChannelReceiver extends ChannelNetwork {\n constructor(requestHandlers, options) {\n super(requestHandlers, { ...channelReceiverDefaultOptions, ...options });\n __publicField(this, \"_ready\", false);\n window.addEventListener(\"message\", (event) => {\n this._onPublicMessage(event);\n });\n }\n /**\n * Tells the emitter that receiver is ready\n */\n async ready() {\n if (window.parent === window) {\n throw new Error(\"Receiver is currently not embedded as an iframe\");\n }\n this._ready = false;\n const request = this.createRequestMessage(InternalReceiverRequestType.Ready, void 0);\n const response = await this.postRequest(request, (request2) => {\n window.parent.postMessage(request2, \"*\");\n }, {\n timeout: this.options.readyTimeout\n });\n this._ready = true;\n return response;\n }\n /**\n * Handles public messages\n */\n _onPublicMessage(event) {\n try {\n const message = validateMessage(event.data);\n if (isRequestMessage(message)) {\n if (this.options.debug) {\n console.debug(event.data);\n }\n switch (message.type) {\n case InternalEmitterRequestType.Connect:\n this.port = event.ports[0];\n const { data } = message;\n this.options = {\n ...this.options,\n ...data,\n // Ensure core options remain the same\n debug: this.options.debug,\n requestIDPrefix: this.options.requestIDPrefix,\n readyTimeout: this.options.readyTimeout\n };\n const response = createSuccessResponseMessage(message.requestID, void 0);\n this.postResponse(response);\n break;\n default:\n this.postResponse(createErrorResponseMessage(message.requestID, void 0), (response2) => {\n event.source.postMessage(response2, event.origin);\n });\n break;\n }\n } else {\n if (!this._ready) {\n this.onMessage(event);\n }\n }\n } catch (error) {\n if (error instanceof TypeError)\n ;\n else {\n throw error;\n }\n }\n }\n postFormattedRequest(type, data, options = {}) {\n if (!this._ready) {\n throw new NotReadyError(\"Receiver is not ready, use `ChannelReceiver.ready()` first\");\n }\n return this.postRequest(this.createRequestMessage(type, data), void 0, options);\n }\n}\nexport {\n ChannelReceiver,\n channelReceiverDefaultOptions\n};\n//# sourceMappingURL=ChannelReceiver.js.map\n"],"names":[],"mappings":";;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAKK,MAAC,gCAAgC;AAAA,EACpC,cAAc;AAAA,EACd,iBAAiB;AACnB;AACA,MAAM,wBAAwB,eAAe;AAAA,EAC3C,YAAY,iBAAiB,SAAS;AACpC,UAAM,iBAAiB,EAAE,GAAG,+BAA+B,GAAG,QAAS,CAAA;AACvE,kBAAc,MAAM,UAAU,KAAK;AACnC,WAAO,iBAAiB,WAAW,CAAC,UAAU;AAC5C,WAAK,iBAAiB,KAAK;AAAA,IACjC,CAAK;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAID,MAAM,QAAQ;AACZ,QAAI,OAAO,WAAW,QAAQ;AAC5B,YAAM,IAAI,MAAM,iDAAiD;AAAA,IAClE;AACD,SAAK,SAAS;AACd,UAAM,UAAU,KAAK,qBAAqB,4BAA4B,OAAO,MAAM;AACnF,UAAM,WAAW,MAAM,KAAK,YAAY,SAAS,CAAC,aAAa;AAC7D,aAAO,OAAO,YAAY,UAAU,GAAG;AAAA,IAC7C,GAAO;AAAA,MACD,SAAS,KAAK,QAAQ;AAAA,IAC5B,CAAK;AACD,SAAK,SAAS;AACd,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA,EAID,iBAAiB,OAAO;AACtB,QAAI;AACF,YAAM,UAAU,gBAAgB,MAAM,IAAI;AAC1C,UAAI,iBAAiB,OAAO,GAAG;AAC7B,YAAI,KAAK,QAAQ,OAAO;AACtB,kBAAQ,MAAM,MAAM,IAAI;AAAA,QACzB;AACD,gBAAQ,QAAQ,MAAI;AAAA,UAClB,KAAK,2BAA2B;AAC9B,iBAAK,OAAO,MAAM,MAAM,CAAC;AACzB,kBAAM,EAAE,KAAM,IAAG;AACjB,iBAAK,UAAU;AAAA,cACb,GAAG,KAAK;AAAA,cACR,GAAG;AAAA;AAAA,cAEH,OAAO,KAAK,QAAQ;AAAA,cACpB,iBAAiB,KAAK,QAAQ;AAAA,cAC9B,cAAc,KAAK,QAAQ;AAAA,YACzC;AACY,kBAAM,WAAW,6BAA6B,QAAQ,WAAW,MAAM;AACvE,iBAAK,aAAa,QAAQ;AAC1B;AAAA,UACF;AACE,iBAAK,aAAa,2BAA2B,QAAQ,WAAW,MAAM,GAAG,CAAC,cAAc;AACtF,oBAAM,OAAO,YAAY,WAAW,MAAM,MAAM;AAAA,YAC9D,CAAa;AACD;AAAA,QACH;AAAA,MACT,OAAa;AACL,YAAI,CAAC,KAAK,QAAQ;AAChB,eAAK,UAAU,KAAK;AAAA,QACrB;AAAA,MACF;AAAA,IACF,SAAQ,OAAO;AACd,UAAI,iBAAiB;AACnB;AAAA,WACG;AACH,cAAM;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAAA,EACD,qBAAqB,MAAM,MAAM,UAAU,CAAA,GAAI;AAC7C,QAAI,CAAC,KAAK,QAAQ;AAChB,YAAM,IAAI,cAAc,4DAA4D;AAAA,IACrF;AACD,WAAO,KAAK,YAAY,KAAK,qBAAqB,MAAM,IAAI,GAAG,QAAQ,OAAO;AAAA,EAC/E;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/errors.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass ResponseError extends Error {\n constructor(errorResponse) {\n super(errorResponse.msg);\n __publicField(this, \"response\");\n this.response = errorResponse;\n }\n}\nclass ConnectionTimeoutError extends Error {\n constructor() {\n super(\"Connection timed out\");\n }\n}\nclass TooManyConcurrentRequestsError extends Error {\n constructor(request) {\n super(`Too many concurrent requests`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass RequestTimeoutError extends Error {\n constructor(request) {\n super(`Request \\`${request.requestID}\\` timed out`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass NotReadyError extends Error {\n}\nclass PortNotSetError extends Error {\n constructor() {\n super(\"Port is not set\");\n }\n}\nclass ChannelNotSetError extends Error {\n constructor() {\n super(\"Channel is not set\");\n }\n}\nexport {\n ChannelNotSetError,\n ConnectionTimeoutError,\n NotReadyError,\n PortNotSetError,\n RequestTimeoutError,\n ResponseError,\n TooManyConcurrentRequestsError\n};\n//# sourceMappingURL=errors.js.map\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AACA,MAAM,sBAAsB,MAAM;AAAA,EAChC,YAAY,eAAe;AACzB,UAAM,cAAc,GAAG;AACvB,kBAAc,MAAM,UAAU;AAC9B,SAAK,WAAW;AAAA,EACjB;AACH;AAMA,MAAM,uCAAuC,MAAM;AAAA,EACjD,YAAY,SAAS;AACnB,UAAM,8BAA8B;AACpC,kBAAc,MAAM,SAAS;AAC7B,SAAK,UAAU;AAAA,EAChB;AACH;AACA,MAAM,4BAA4B,MAAM;AAAA,EACtC,YAAY,SAAS;AACnB,UAAM,aAAa,QAAQ,
|
|
1
|
+
{"version":3,"file":"errors.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/errors.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass ResponseError extends Error {\n constructor(errorResponse) {\n super(errorResponse.msg);\n __publicField(this, \"response\");\n this.response = errorResponse;\n }\n}\nclass ConnectionTimeoutError extends Error {\n constructor() {\n super(\"Connection timed out\");\n }\n}\nclass TooManyConcurrentRequestsError extends Error {\n constructor(request) {\n super(`Too many concurrent requests`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass RequestTimeoutError extends Error {\n constructor(request) {\n super(`Request \\`${request.requestID}\\` timed out`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass NotReadyError extends Error {\n}\nclass PortNotSetError extends Error {\n constructor() {\n super(\"Port is not set\");\n }\n}\nclass ChannelNotSetError extends Error {\n constructor() {\n super(\"Channel is not set\");\n }\n}\nexport {\n ChannelNotSetError,\n ConnectionTimeoutError,\n NotReadyError,\n PortNotSetError,\n RequestTimeoutError,\n ResponseError,\n TooManyConcurrentRequestsError\n};\n//# sourceMappingURL=errors.js.map\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AACA,MAAM,sBAAsB,MAAM;AAAA,EAChC,YAAY,eAAe;AACzB,UAAM,cAAc,GAAG;AACvB,kBAAc,MAAM,UAAU;AAC9B,SAAK,WAAW;AAAA,EACjB;AACH;AAMA,MAAM,uCAAuC,MAAM;AAAA,EACjD,YAAY,SAAS;AACnB,UAAM,8BAA8B;AACpC,kBAAc,MAAM,SAAS;AAC7B,SAAK,UAAU;AAAA,EAChB;AACH;AACA,MAAM,4BAA4B,MAAM;AAAA,EACtC,YAAY,SAAS;AACnB,UAAM,aAAa,QAAQ,SAAS,cAAc;AAClD,kBAAc,MAAM,SAAS;AAC7B,SAAK,UAAU;AAAA,EAChB;AACH;AACA,MAAM,sBAAsB,MAAM;AAClC;AACA,MAAM,wBAAwB,MAAM;AAAA,EAClC,cAAc;AACZ,UAAM,iBAAiB;AAAA,EACxB;AACH;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/errors.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass ResponseError extends Error {\n constructor(errorResponse) {\n super(errorResponse.msg);\n __publicField(this, \"response\");\n this.response = errorResponse;\n }\n}\nclass ConnectionTimeoutError extends Error {\n constructor() {\n super(\"Connection timed out\");\n }\n}\nclass TooManyConcurrentRequestsError extends Error {\n constructor(request) {\n super(`Too many concurrent requests`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass RequestTimeoutError extends Error {\n constructor(request) {\n super(`Request \\`${request.requestID}\\` timed out`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass NotReadyError extends Error {\n}\nclass PortNotSetError extends Error {\n constructor() {\n super(\"Port is not set\");\n }\n}\nclass ChannelNotSetError extends Error {\n constructor() {\n super(\"Channel is not set\");\n }\n}\nexport {\n ChannelNotSetError,\n ConnectionTimeoutError,\n NotReadyError,\n PortNotSetError,\n RequestTimeoutError,\n ResponseError,\n TooManyConcurrentRequestsError\n};\n//# sourceMappingURL=errors.js.map\n"],"names":[],"mappings":"AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AACA,MAAM,sBAAsB,MAAM;AAAA,EAChC,YAAY,eAAe;AACzB,UAAM,cAAc,GAAG;AACvB,kBAAc,MAAM,UAAU;AAC9B,SAAK,WAAW;AAAA,EACjB;AACH;AAMA,MAAM,uCAAuC,MAAM;AAAA,EACjD,YAAY,SAAS;AACnB,UAAM,8BAA8B;AACpC,kBAAc,MAAM,SAAS;AAC7B,SAAK,UAAU;AAAA,EAChB;AACH;AACA,MAAM,4BAA4B,MAAM;AAAA,EACtC,YAAY,SAAS;AACnB,UAAM,aAAa,QAAQ,
|
|
1
|
+
{"version":3,"file":"errors.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/errors.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass ResponseError extends Error {\n constructor(errorResponse) {\n super(errorResponse.msg);\n __publicField(this, \"response\");\n this.response = errorResponse;\n }\n}\nclass ConnectionTimeoutError extends Error {\n constructor() {\n super(\"Connection timed out\");\n }\n}\nclass TooManyConcurrentRequestsError extends Error {\n constructor(request) {\n super(`Too many concurrent requests`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass RequestTimeoutError extends Error {\n constructor(request) {\n super(`Request \\`${request.requestID}\\` timed out`);\n __publicField(this, \"request\");\n this.request = request;\n }\n}\nclass NotReadyError extends Error {\n}\nclass PortNotSetError extends Error {\n constructor() {\n super(\"Port is not set\");\n }\n}\nclass ChannelNotSetError extends Error {\n constructor() {\n super(\"Channel is not set\");\n }\n}\nexport {\n ChannelNotSetError,\n ConnectionTimeoutError,\n NotReadyError,\n PortNotSetError,\n RequestTimeoutError,\n ResponseError,\n TooManyConcurrentRequestsError\n};\n//# sourceMappingURL=errors.js.map\n"],"names":[],"mappings":"AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AACA,MAAM,sBAAsB,MAAM;AAAA,EAChC,YAAY,eAAe;AACzB,UAAM,cAAc,GAAG;AACvB,kBAAc,MAAM,UAAU;AAC9B,SAAK,WAAW;AAAA,EACjB;AACH;AAMA,MAAM,uCAAuC,MAAM;AAAA,EACjD,YAAY,SAAS;AACnB,UAAM,8BAA8B;AACpC,kBAAc,MAAM,SAAS;AAC7B,SAAK,UAAU;AAAA,EAChB;AACH;AACA,MAAM,4BAA4B,MAAM;AAAA,EACtC,YAAY,SAAS;AACnB,UAAM,aAAa,QAAQ,SAAS,cAAc;AAClD,kBAAc,MAAM,SAAS;AAC7B,SAAK,UAAU;AAAA,EAChB;AACH;AACA,MAAM,sBAAsB,MAAM;AAClC;AACA,MAAM,wBAAwB,MAAM;AAAA,EAClC,cAAc;AACZ,UAAM,iBAAiB;AAAA,EACxB;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/messages.js"],"sourcesContent":["import statuses from \"statuses\";\nlet requestID = 0;\nconst createRequestMessage = (type, data, prefix = \"\") => {\n return {\n requestID: `${prefix}${requestID++}`,\n type,\n data\n };\n};\nconst createSuccessResponseMessage = (requestID2, data, status = 200) => {\n var _a;\n if (status >= 400) {\n throw new TypeError(`Invalid success status code, expected status to be within \\`[100;400[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n data\n };\n};\nconst createErrorResponseMessage = (requestID2, error, status = 400) => {\n var _a;\n if (status < 400) {\n throw new TypeError(`Invalid error status code, expected status to be within \\`[500;600[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n error\n };\n};\nconst validateMessage = (message) => {\n if (typeof message !== \"object\" || message === null) {\n throw new TypeError(`Invalid message received, expected message to be of type \\`object\\`, got \\`${typeof message}\\``);\n } else if (!Object.keys(message).every((key) => [\"requestID\", \"type\", \"data\", \"status\", \"msg\", \"error\"].includes(key))) {\n throw new TypeError(`Invalid message received: ${JSON.stringify(message)}`);\n } else if (typeof message.requestID !== \"string\") {\n throw new TypeError(`Invalid message received, expected \\`message.requestID\\` to be of type \\`string\\`, got \\`${typeof message.id}\\``);\n }\n return message;\n};\nconst isRequestMessage = (message) => {\n return \"type\" in message;\n};\nconst isResponseMessage = (message) => {\n return !(\"type\" in message);\n};\nconst isSuccessResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"error\" in message);\n};\nconst isErrorResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"data\" in message);\n};\nexport {\n createErrorResponseMessage,\n createRequestMessage,\n createSuccessResponseMessage,\n isErrorResponseMessage,\n isRequestMessage,\n isResponseMessage,\n isSuccessResponseMessage,\n validateMessage\n};\n//# sourceMappingURL=messages.js.map\n"],"names":["statuses"],"mappings":";;;AACA,IAAI,YAAY;AACX,MAAC,uBAAuB,CAAC,MAAM,MAAM,SAAS,OAAO;AACxD,SAAO;AAAA,IACL,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"messages.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/messages.js"],"sourcesContent":["import statuses from \"statuses\";\nlet requestID = 0;\nconst createRequestMessage = (type, data, prefix = \"\") => {\n return {\n requestID: `${prefix}${requestID++}`,\n type,\n data\n };\n};\nconst createSuccessResponseMessage = (requestID2, data, status = 200) => {\n var _a;\n if (status >= 400) {\n throw new TypeError(`Invalid success status code, expected status to be within \\`[100;400[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n data\n };\n};\nconst createErrorResponseMessage = (requestID2, error, status = 400) => {\n var _a;\n if (status < 400) {\n throw new TypeError(`Invalid error status code, expected status to be within \\`[500;600[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n error\n };\n};\nconst validateMessage = (message) => {\n if (typeof message !== \"object\" || message === null) {\n throw new TypeError(`Invalid message received, expected message to be of type \\`object\\`, got \\`${typeof message}\\``);\n } else if (!Object.keys(message).every((key) => [\"requestID\", \"type\", \"data\", \"status\", \"msg\", \"error\"].includes(key))) {\n throw new TypeError(`Invalid message received: ${JSON.stringify(message)}`);\n } else if (typeof message.requestID !== \"string\") {\n throw new TypeError(`Invalid message received, expected \\`message.requestID\\` to be of type \\`string\\`, got \\`${typeof message.id}\\``);\n }\n return message;\n};\nconst isRequestMessage = (message) => {\n return \"type\" in message;\n};\nconst isResponseMessage = (message) => {\n return !(\"type\" in message);\n};\nconst isSuccessResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"error\" in message);\n};\nconst isErrorResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"data\" in message);\n};\nexport {\n createErrorResponseMessage,\n createRequestMessage,\n createSuccessResponseMessage,\n isErrorResponseMessage,\n isRequestMessage,\n isResponseMessage,\n isSuccessResponseMessage,\n validateMessage\n};\n//# sourceMappingURL=messages.js.map\n"],"names":["statuses"],"mappings":";;;AACA,IAAI,YAAY;AACX,MAAC,uBAAuB,CAAC,MAAM,MAAM,SAAS,OAAO;AACxD,SAAO;AAAA,IACL,WAAW,GAAG,MAAM,GAAG,WAAW;AAAA,IAClC;AAAA,IACA;AAAA,EACJ;AACA;AACK,MAAC,+BAA+B,CAAC,YAAY,MAAM,SAAS,QAAQ;AACvE,MAAI;AACJ,MAAI,UAAU,KAAK;AACjB,UAAM,IAAI,UAAU,kFAAkF,MAAM,IAAI;AAAA,EACjH;AACD,SAAO;AAAA,IACL,WAAW;AAAA,IACX;AAAA,IACA,OAAO,KAAKA,MAAS,QAAQ,MAAM,MAAM,OAAO,SAAS,GAAG,QAAQ,OAAO,EAAE,EAAE,YAAW,MAAO;AAAA,IACjG;AAAA,EACJ;AACA;AACK,MAAC,6BAA6B,CAAC,YAAY,OAAO,SAAS,QAAQ;AACtE,MAAI;AACJ,MAAI,SAAS,KAAK;AAChB,UAAM,IAAI,UAAU,gFAAgF,MAAM,IAAI;AAAA,EAC/G;AACD,SAAO;AAAA,IACL,WAAW;AAAA,IACX;AAAA,IACA,OAAO,KAAKA,MAAS,QAAQ,MAAM,MAAM,OAAO,SAAS,GAAG,QAAQ,OAAO,EAAE,EAAE,YAAW,MAAO;AAAA,IACjG;AAAA,EACJ;AACA;AACK,MAAC,kBAAkB,CAAC,YAAY;AACnC,MAAI,OAAO,YAAY,YAAY,YAAY,MAAM;AACnD,UAAM,IAAI,UAAU,8EAA8E,OAAO,OAAO,IAAI;AAAA,EACxH,WAAa,CAAC,OAAO,KAAK,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,aAAa,QAAQ,QAAQ,UAAU,OAAO,OAAO,EAAE,SAAS,GAAG,CAAC,GAAG;AACtH,UAAM,IAAI,UAAU,6BAA6B,KAAK,UAAU,OAAO,CAAC,EAAE;AAAA,EAC3E,WAAU,OAAO,QAAQ,cAAc,UAAU;AAChD,UAAM,IAAI,UAAU,4FAA4F,OAAO,QAAQ,EAAE,IAAI;AAAA,EACtI;AACD,SAAO;AACT;AACK,MAAC,mBAAmB,CAAC,YAAY;AACpC,SAAO,UAAU;AACnB;AACK,MAAC,oBAAoB,CAAC,YAAY;AACrC,SAAO,EAAE,UAAU;AACrB;AACK,MAAC,2BAA2B,CAAC,YAAY;AAC5C,SAAO,kBAAkB,OAAO,KAAK,EAAE,WAAW;AACpD;;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/messages.js"],"sourcesContent":["import statuses from \"statuses\";\nlet requestID = 0;\nconst createRequestMessage = (type, data, prefix = \"\") => {\n return {\n requestID: `${prefix}${requestID++}`,\n type,\n data\n };\n};\nconst createSuccessResponseMessage = (requestID2, data, status = 200) => {\n var _a;\n if (status >= 400) {\n throw new TypeError(`Invalid success status code, expected status to be within \\`[100;400[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n data\n };\n};\nconst createErrorResponseMessage = (requestID2, error, status = 400) => {\n var _a;\n if (status < 400) {\n throw new TypeError(`Invalid error status code, expected status to be within \\`[500;600[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n error\n };\n};\nconst validateMessage = (message) => {\n if (typeof message !== \"object\" || message === null) {\n throw new TypeError(`Invalid message received, expected message to be of type \\`object\\`, got \\`${typeof message}\\``);\n } else if (!Object.keys(message).every((key) => [\"requestID\", \"type\", \"data\", \"status\", \"msg\", \"error\"].includes(key))) {\n throw new TypeError(`Invalid message received: ${JSON.stringify(message)}`);\n } else if (typeof message.requestID !== \"string\") {\n throw new TypeError(`Invalid message received, expected \\`message.requestID\\` to be of type \\`string\\`, got \\`${typeof message.id}\\``);\n }\n return message;\n};\nconst isRequestMessage = (message) => {\n return \"type\" in message;\n};\nconst isResponseMessage = (message) => {\n return !(\"type\" in message);\n};\nconst isSuccessResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"error\" in message);\n};\nconst isErrorResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"data\" in message);\n};\nexport {\n createErrorResponseMessage,\n createRequestMessage,\n createSuccessResponseMessage,\n isErrorResponseMessage,\n isRequestMessage,\n isResponseMessage,\n isSuccessResponseMessage,\n validateMessage\n};\n//# sourceMappingURL=messages.js.map\n"],"names":[],"mappings":";AACA,IAAI,YAAY;AACX,MAAC,uBAAuB,CAAC,MAAM,MAAM,SAAS,OAAO;AACxD,SAAO;AAAA,IACL,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"messages.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/channel/messages.js"],"sourcesContent":["import statuses from \"statuses\";\nlet requestID = 0;\nconst createRequestMessage = (type, data, prefix = \"\") => {\n return {\n requestID: `${prefix}${requestID++}`,\n type,\n data\n };\n};\nconst createSuccessResponseMessage = (requestID2, data, status = 200) => {\n var _a;\n if (status >= 400) {\n throw new TypeError(`Invalid success status code, expected status to be within \\`[100;400[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n data\n };\n};\nconst createErrorResponseMessage = (requestID2, error, status = 400) => {\n var _a;\n if (status < 400) {\n throw new TypeError(`Invalid error status code, expected status to be within \\`[500;600[\\`, got \\`${status}\\``);\n }\n return {\n requestID: requestID2,\n status,\n msg: ((_a = statuses.message[status]) == null ? void 0 : _a.replace(/\\.$/, \"\").toLowerCase()) ?? \"\",\n error\n };\n};\nconst validateMessage = (message) => {\n if (typeof message !== \"object\" || message === null) {\n throw new TypeError(`Invalid message received, expected message to be of type \\`object\\`, got \\`${typeof message}\\``);\n } else if (!Object.keys(message).every((key) => [\"requestID\", \"type\", \"data\", \"status\", \"msg\", \"error\"].includes(key))) {\n throw new TypeError(`Invalid message received: ${JSON.stringify(message)}`);\n } else if (typeof message.requestID !== \"string\") {\n throw new TypeError(`Invalid message received, expected \\`message.requestID\\` to be of type \\`string\\`, got \\`${typeof message.id}\\``);\n }\n return message;\n};\nconst isRequestMessage = (message) => {\n return \"type\" in message;\n};\nconst isResponseMessage = (message) => {\n return !(\"type\" in message);\n};\nconst isSuccessResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"error\" in message);\n};\nconst isErrorResponseMessage = (message) => {\n return isResponseMessage(message) && !(\"data\" in message);\n};\nexport {\n createErrorResponseMessage,\n createRequestMessage,\n createSuccessResponseMessage,\n isErrorResponseMessage,\n isRequestMessage,\n isResponseMessage,\n isSuccessResponseMessage,\n validateMessage\n};\n//# sourceMappingURL=messages.js.map\n"],"names":[],"mappings":";AACA,IAAI,YAAY;AACX,MAAC,uBAAuB,CAAC,MAAM,MAAM,SAAS,OAAO;AACxD,SAAO;AAAA,IACL,WAAW,GAAG,MAAM,GAAG,WAAW;AAAA,IAClC;AAAA,IACA;AAAA,EACJ;AACA;AACK,MAAC,+BAA+B,CAAC,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OAAO,KAAK,EAAE,WAAW;AACpD;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimulatorManager.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/SimulatorManager.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { throttle } from \"../lib/throttle.js\";\nimport { ClientRequestType } from \"../types.js\";\nimport { StateEventType } from \"./types.js\";\nimport { SimulatorAPI } from \"../SimulatorAPI.js\";\nimport { ResponseError } from \"../channel/errors.js\";\nimport \"statuses\";\nimport \"../channel/types.js\";\nimport { State } from \"./State.js\";\nimport { getSliceZoneDOM, getSimulatorDOM, getSimulatorRootDOM } from \"./domHelpers.js\";\nimport { sliceSimulatorAccessedDirectly } from \"./messages.js\";\nclass SimulatorManager {\n constructor(args) {\n __publicField(this, \"state\");\n __publicField(this, \"_api\");\n __publicField(this, \"_initialized\");\n this.state = new State(args);\n this._api = null;\n this._initialized = false;\n }\n async init() {\n if (this._initialized) {\n return;\n } else {\n this._initialized = true;\n }\n await this.state.init();\n try {\n await this._initAPI();\n } catch (error) {\n if (error instanceof Error && error.message === \"Receiver is currently not embedded as an iframe\" && !this.state.slices.length) {\n this.state.message = sliceSimulatorAccessedDirectly;\n }\n console.error(error);\n return;\n }\n this._initListeners();\n }\n async _initAPI() {\n this._api = new SimulatorAPI({\n [ClientRequestType.SetSliceZone]: (req, res) => {\n this.state.setSliceZone(req.data);\n return res.success();\n },\n [ClientRequestType.ScrollToSlice]: (req, res) => {\n var _a;\n if (req.data.sliceIndex < 0) {\n return res.error(\"`sliceIndex` must be > 0\", 400);\n } else if (req.data.sliceIndex >= this.state.slices.length) {\n return res.error(`\\`sliceIndex\\` must be < ${this.state.slices.length} (\\`<SliceZone />\\` current length)`, 400);\n }\n const $sliceZone = getSliceZoneDOM(this.state.slices.length);\n if (!$sliceZone) {\n return res.error(\"Failed to find `<SliceZone />`\", 500);\n }\n this.state.activeSlice = null;\n const $slice = $sliceZone.children[req.data.sliceIndex];\n if (!$slice) {\n return res.error(`Failed fo find slice at index $\\`{req.data.sliceIndex}\\` in \\`<SliceZone />\\``, 500);\n }\n $slice.scrollIntoView({\n behavior: req.data.behavior,\n block: req.data.block,\n inline: req.data.inline\n });\n ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) && setTimeout(this.state.setActiveSlice, 750);\n return res.success();\n }\n });\n await this._api.ready();\n }\n _initListeners() {\n var _a, _b;\n if ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) {\n window.addEventListener(\"mousemove\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"resize\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"mousewheel\", () => {\n setTimeout(this.state.setActiveSlice, 200);\n });\n this.state.on(StateEventType.Slices, () => {\n this.state.setActiveSlice();\n });\n this.state.on(StateEventType.ActiveSlice, async (activeSlice) => {\n if (this._api) {\n try {\n await this._api.setActiveSlice(activeSlice);\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n });\n }\n if ((_b = this._api) == null ? void 0 : _b.options.sliceZoneSizeAPI) {\n const resizeObserver = new ResizeObserver(throttle(async (entries) => {\n const [entry] = entries;\n if (this._api && entry) {\n try {\n await this._api.setSliceZoneSize({ rect: entry.contentRect });\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n }, 16));\n const observeSimulatorRoot = () => {\n const simulatorRootDOM = getSimulatorRootDOM();\n resizeObserver.disconnect();\n if (simulatorRootDOM) {\n resizeObserver.observe(simulatorRootDOM);\n }\n };\n const mutationObserver = new MutationObserver(observeSimulatorRoot);\n mutationObserver.observe(getSimulatorDOM(), {\n subtree: false,\n childList: true\n });\n }\n }\n}\nexport {\n SimulatorManager\n};\n//# sourceMappingURL=SimulatorManager.js.map\n"],"names":["State","sliceSimulatorAccessedDirectly","SimulatorAPI","ClientRequestType","getSliceZoneDOM","StateEventType","ResponseError","throttle","getSimulatorRootDOM","getSimulatorDOM"],"mappings":";;;;;;;;;;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAWA,MAAM,iBAAiB;AAAA,EACrB,YAAY,MAAM;AAChB,kBAAc,MAAM,OAAO;AAC3B,kBAAc,MAAM,MAAM;AAC1B,kBAAc,MAAM,cAAc;AAClC,SAAK,QAAQ,IAAIA,MAAK,MAAC,IAAI;AAC3B,SAAK,OAAO;AACZ,SAAK,eAAe;AAAA,EACrB;AAAA,EACD,MAAM,OAAO;AACX,QAAI,KAAK,cAAc;AACrB;AAAA,IACN,OAAW;AACL,WAAK,eAAe;AAAA,IACrB;AACD,UAAM,KAAK,MAAM;AACjB,QAAI;AACF,YAAM,KAAK;IACZ,SAAQ,
|
|
1
|
+
{"version":3,"file":"SimulatorManager.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/SimulatorManager.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { throttle } from \"../lib/throttle.js\";\nimport { ClientRequestType } from \"../types.js\";\nimport { StateEventType } from \"./types.js\";\nimport { SimulatorAPI } from \"../SimulatorAPI.js\";\nimport { ResponseError } from \"../channel/errors.js\";\nimport \"statuses\";\nimport \"../channel/types.js\";\nimport { State } from \"./State.js\";\nimport { getSliceZoneDOM, getSimulatorDOM, getSimulatorRootDOM } from \"./domHelpers.js\";\nimport { sliceSimulatorAccessedDirectly } from \"./messages.js\";\nclass SimulatorManager {\n constructor(args) {\n __publicField(this, \"state\");\n __publicField(this, \"_api\");\n __publicField(this, \"_initialized\");\n this.state = new State(args);\n this._api = null;\n this._initialized = false;\n }\n async init() {\n if (this._initialized) {\n return;\n } else {\n this._initialized = true;\n }\n await this.state.init();\n try {\n await this._initAPI();\n } catch (error) {\n if (error instanceof Error && error.message === \"Receiver is currently not embedded as an iframe\" && !this.state.slices.length) {\n this.state.message = sliceSimulatorAccessedDirectly;\n }\n console.error(error);\n return;\n }\n this._initListeners();\n }\n async _initAPI() {\n this._api = new SimulatorAPI({\n [ClientRequestType.SetSliceZone]: (req, res) => {\n this.state.setSliceZone(req.data);\n return res.success();\n },\n [ClientRequestType.ScrollToSlice]: (req, res) => {\n var _a;\n if (req.data.sliceIndex < 0) {\n return res.error(\"`sliceIndex` must be > 0\", 400);\n } else if (req.data.sliceIndex >= this.state.slices.length) {\n return res.error(`\\`sliceIndex\\` must be < ${this.state.slices.length} (\\`<SliceZone />\\` current length)`, 400);\n }\n const $sliceZone = getSliceZoneDOM(this.state.slices.length);\n if (!$sliceZone) {\n return res.error(\"Failed to find `<SliceZone />`\", 500);\n }\n this.state.activeSlice = null;\n const $slice = $sliceZone.children[req.data.sliceIndex];\n if (!$slice) {\n return res.error(`Failed fo find slice at index $\\`{req.data.sliceIndex}\\` in \\`<SliceZone />\\``, 500);\n }\n $slice.scrollIntoView({\n behavior: req.data.behavior,\n block: req.data.block,\n inline: req.data.inline\n });\n ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) && setTimeout(this.state.setActiveSlice, 750);\n return res.success();\n }\n });\n await this._api.ready();\n }\n _initListeners() {\n var _a, _b;\n if ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) {\n window.addEventListener(\"mousemove\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"resize\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"mousewheel\", () => {\n setTimeout(this.state.setActiveSlice, 200);\n });\n this.state.on(StateEventType.Slices, () => {\n this.state.setActiveSlice();\n });\n this.state.on(StateEventType.ActiveSlice, async (activeSlice) => {\n if (this._api) {\n try {\n await this._api.setActiveSlice(activeSlice);\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n });\n }\n if ((_b = this._api) == null ? void 0 : _b.options.sliceZoneSizeAPI) {\n const resizeObserver = new ResizeObserver(throttle(async (entries) => {\n const [entry] = entries;\n if (this._api && entry) {\n try {\n await this._api.setSliceZoneSize({ rect: entry.contentRect });\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n }, 16));\n const observeSimulatorRoot = () => {\n const simulatorRootDOM = getSimulatorRootDOM();\n resizeObserver.disconnect();\n if (simulatorRootDOM) {\n resizeObserver.observe(simulatorRootDOM);\n }\n };\n const mutationObserver = new MutationObserver(observeSimulatorRoot);\n mutationObserver.observe(getSimulatorDOM(), {\n subtree: false,\n childList: true\n });\n }\n }\n}\nexport {\n SimulatorManager\n};\n//# sourceMappingURL=SimulatorManager.js.map\n"],"names":["State","sliceSimulatorAccessedDirectly","SimulatorAPI","ClientRequestType","getSliceZoneDOM","StateEventType","ResponseError","throttle","getSimulatorRootDOM","getSimulatorDOM"],"mappings":";;;;;;;;;;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UA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P;AAAA,UACF;AAAA,QACF;AAAA,MACT,CAAO;AAAA,IACF;AACD,SAAK,KAAK,KAAK,SAAS,OAAO,SAAS,GAAG,QAAQ,kBAAkB;AACnE,YAAM,iBAAiB,IAAI,eAAeC,SAAQ,SAAC,OAAO,YAAY;AACpE,cAAM,CAAC,KAAK,IAAI;AAChB,YAAI,KAAK,QAAQ,OAAO;AACtB,cAAI;AACF,kBAAM,KAAK,KAAK,iBAAiB,EAAE,MAAM,MAAM,YAAW,CAAE;AAAA,UAC7D,SAAQ,OAAO;AACd,gBAAI,iBAAiBD,OAAAA,iBAAiB,MAAM,SAAS,WAAW,KAAK;AACnE,sBAAQ,MAAM,MAAM,QAAQ;AAAA,YAC1C,OAAmB;AACL,oBAAM;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MACT,GAAS,EAAE,CAAC;AACN,YAAM,uBAAuB,MAAM;AACjC,cAAM,mBAAmBE,WAAAA;AACzB,uBAAe,WAAU;AACzB,YAAI,kBAAkB;AACpB,yBAAe,QAAQ,gBAAgB;AAAA,QACxC;AAAA,MACT;AACM,YAAM,mBAAmB,IAAI,iBAAiB,oBAAoB;AAClE,uBAAiB,QAAQC,WAAAA,mBAAmB;AAAA,QAC1C,SAAS;AAAA,QACT,WAAW;AAAA,MACnB,CAAO;AAAA,IACF;AAAA,EACF;AACH;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimulatorManager.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/SimulatorManager.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { throttle } from \"../lib/throttle.js\";\nimport { ClientRequestType } from \"../types.js\";\nimport { StateEventType } from \"./types.js\";\nimport { SimulatorAPI } from \"../SimulatorAPI.js\";\nimport { ResponseError } from \"../channel/errors.js\";\nimport \"statuses\";\nimport \"../channel/types.js\";\nimport { State } from \"./State.js\";\nimport { getSliceZoneDOM, getSimulatorDOM, getSimulatorRootDOM } from \"./domHelpers.js\";\nimport { sliceSimulatorAccessedDirectly } from \"./messages.js\";\nclass SimulatorManager {\n constructor(args) {\n __publicField(this, \"state\");\n __publicField(this, \"_api\");\n __publicField(this, \"_initialized\");\n this.state = new State(args);\n this._api = null;\n this._initialized = false;\n }\n async init() {\n if (this._initialized) {\n return;\n } else {\n this._initialized = true;\n }\n await this.state.init();\n try {\n await this._initAPI();\n } catch (error) {\n if (error instanceof Error && error.message === \"Receiver is currently not embedded as an iframe\" && !this.state.slices.length) {\n this.state.message = sliceSimulatorAccessedDirectly;\n }\n console.error(error);\n return;\n }\n this._initListeners();\n }\n async _initAPI() {\n this._api = new SimulatorAPI({\n [ClientRequestType.SetSliceZone]: (req, res) => {\n this.state.setSliceZone(req.data);\n return res.success();\n },\n [ClientRequestType.ScrollToSlice]: (req, res) => {\n var _a;\n if (req.data.sliceIndex < 0) {\n return res.error(\"`sliceIndex` must be > 0\", 400);\n } else if (req.data.sliceIndex >= this.state.slices.length) {\n return res.error(`\\`sliceIndex\\` must be < ${this.state.slices.length} (\\`<SliceZone />\\` current length)`, 400);\n }\n const $sliceZone = getSliceZoneDOM(this.state.slices.length);\n if (!$sliceZone) {\n return res.error(\"Failed to find `<SliceZone />`\", 500);\n }\n this.state.activeSlice = null;\n const $slice = $sliceZone.children[req.data.sliceIndex];\n if (!$slice) {\n return res.error(`Failed fo find slice at index $\\`{req.data.sliceIndex}\\` in \\`<SliceZone />\\``, 500);\n }\n $slice.scrollIntoView({\n behavior: req.data.behavior,\n block: req.data.block,\n inline: req.data.inline\n });\n ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) && setTimeout(this.state.setActiveSlice, 750);\n return res.success();\n }\n });\n await this._api.ready();\n }\n _initListeners() {\n var _a, _b;\n if ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) {\n window.addEventListener(\"mousemove\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"resize\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"mousewheel\", () => {\n setTimeout(this.state.setActiveSlice, 200);\n });\n this.state.on(StateEventType.Slices, () => {\n this.state.setActiveSlice();\n });\n this.state.on(StateEventType.ActiveSlice, async (activeSlice) => {\n if (this._api) {\n try {\n await this._api.setActiveSlice(activeSlice);\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n });\n }\n if ((_b = this._api) == null ? void 0 : _b.options.sliceZoneSizeAPI) {\n const resizeObserver = new ResizeObserver(throttle(async (entries) => {\n const [entry] = entries;\n if (this._api && entry) {\n try {\n await this._api.setSliceZoneSize({ rect: entry.contentRect });\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n }, 16));\n const observeSimulatorRoot = () => {\n const simulatorRootDOM = getSimulatorRootDOM();\n resizeObserver.disconnect();\n if (simulatorRootDOM) {\n resizeObserver.observe(simulatorRootDOM);\n }\n };\n const mutationObserver = new MutationObserver(observeSimulatorRoot);\n mutationObserver.observe(getSimulatorDOM(), {\n subtree: false,\n childList: true\n });\n }\n }\n}\nexport {\n SimulatorManager\n};\n//# sourceMappingURL=SimulatorManager.js.map\n"],"names":[],"mappings":";;;;;;;;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAWA,MAAM,iBAAiB;AAAA,EACrB,YAAY,MAAM;AAChB,kBAAc,MAAM,OAAO;AAC3B,kBAAc,MAAM,MAAM;AAC1B,kBAAc,MAAM,cAAc;AAClC,SAAK,QAAQ,IAAI,MAAM,IAAI;AAC3B,SAAK,OAAO;AACZ,SAAK,eAAe;AAAA,EACrB;AAAA,EACD,MAAM,OAAO;AACX,QAAI,KAAK,cAAc;AACrB;AAAA,IACN,OAAW;AACL,WAAK,eAAe;AAAA,IACrB;AACD,UAAM,KAAK,MAAM;AACjB,QAAI;AACF,YAAM,KAAK;IACZ,SAAQ,
|
|
1
|
+
{"version":3,"file":"SimulatorManager.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/SimulatorManager.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nimport { throttle } from \"../lib/throttle.js\";\nimport { ClientRequestType } from \"../types.js\";\nimport { StateEventType } from \"./types.js\";\nimport { SimulatorAPI } from \"../SimulatorAPI.js\";\nimport { ResponseError } from \"../channel/errors.js\";\nimport \"statuses\";\nimport \"../channel/types.js\";\nimport { State } from \"./State.js\";\nimport { getSliceZoneDOM, getSimulatorDOM, getSimulatorRootDOM } from \"./domHelpers.js\";\nimport { sliceSimulatorAccessedDirectly } from \"./messages.js\";\nclass SimulatorManager {\n constructor(args) {\n __publicField(this, \"state\");\n __publicField(this, \"_api\");\n __publicField(this, \"_initialized\");\n this.state = new State(args);\n this._api = null;\n this._initialized = false;\n }\n async init() {\n if (this._initialized) {\n return;\n } else {\n this._initialized = true;\n }\n await this.state.init();\n try {\n await this._initAPI();\n } catch (error) {\n if (error instanceof Error && error.message === \"Receiver is currently not embedded as an iframe\" && !this.state.slices.length) {\n this.state.message = sliceSimulatorAccessedDirectly;\n }\n console.error(error);\n return;\n }\n this._initListeners();\n }\n async _initAPI() {\n this._api = new SimulatorAPI({\n [ClientRequestType.SetSliceZone]: (req, res) => {\n this.state.setSliceZone(req.data);\n return res.success();\n },\n [ClientRequestType.ScrollToSlice]: (req, res) => {\n var _a;\n if (req.data.sliceIndex < 0) {\n return res.error(\"`sliceIndex` must be > 0\", 400);\n } else if (req.data.sliceIndex >= this.state.slices.length) {\n return res.error(`\\`sliceIndex\\` must be < ${this.state.slices.length} (\\`<SliceZone />\\` current length)`, 400);\n }\n const $sliceZone = getSliceZoneDOM(this.state.slices.length);\n if (!$sliceZone) {\n return res.error(\"Failed to find `<SliceZone />`\", 500);\n }\n this.state.activeSlice = null;\n const $slice = $sliceZone.children[req.data.sliceIndex];\n if (!$slice) {\n return res.error(`Failed fo find slice at index $\\`{req.data.sliceIndex}\\` in \\`<SliceZone />\\``, 500);\n }\n $slice.scrollIntoView({\n behavior: req.data.behavior,\n block: req.data.block,\n inline: req.data.inline\n });\n ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) && setTimeout(this.state.setActiveSlice, 750);\n return res.success();\n }\n });\n await this._api.ready();\n }\n _initListeners() {\n var _a, _b;\n if ((_a = this._api) == null ? void 0 : _a.options.activeSliceAPI) {\n window.addEventListener(\"mousemove\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"resize\", () => {\n this.state.setActiveSlice();\n });\n window.addEventListener(\"mousewheel\", () => {\n setTimeout(this.state.setActiveSlice, 200);\n });\n this.state.on(StateEventType.Slices, () => {\n this.state.setActiveSlice();\n });\n this.state.on(StateEventType.ActiveSlice, async (activeSlice) => {\n if (this._api) {\n try {\n await this._api.setActiveSlice(activeSlice);\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n });\n }\n if ((_b = this._api) == null ? void 0 : _b.options.sliceZoneSizeAPI) {\n const resizeObserver = new ResizeObserver(throttle(async (entries) => {\n const [entry] = entries;\n if (this._api && entry) {\n try {\n await this._api.setSliceZoneSize({ rect: entry.contentRect });\n } catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n console.error(error.response);\n } else {\n throw error;\n }\n }\n }\n }, 16));\n const observeSimulatorRoot = () => {\n const simulatorRootDOM = getSimulatorRootDOM();\n resizeObserver.disconnect();\n if (simulatorRootDOM) {\n resizeObserver.observe(simulatorRootDOM);\n }\n };\n const mutationObserver = new MutationObserver(observeSimulatorRoot);\n mutationObserver.observe(getSimulatorDOM(), {\n subtree: false,\n childList: true\n });\n }\n }\n}\nexport {\n SimulatorManager\n};\n//# sourceMappingURL=SimulatorManager.js.map\n"],"names":[],"mappings":";;;;;;;;;;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AAWA,MAAM,iBAAiB;AAAA,EACrB,YAAY,MAAM;AAChB,kBAAc,MAAM,OAAO;AAC3B,kBAAc,MAAM,MAAM;AAC1B,kBAAc,MAAM,cAAc;AAClC,SAAK,QAAQ,IAAI,MAAM,IAAI;AAC3B,SAAK,OAAO;AACZ,SAAK,eAAe;AAAA,EACrB;AAAA,EACD,MAAM,OAAO;AACX,QAAI,KAAK,cAAc;AACrB;AAAA,IACN,OAAW;AACL,WAAK,eAAe;AAAA,IACrB;AACD,UAAM,KAAK,MAAM;AACjB,QAAI;AACF,YAAM,KAAK;IACZ,SAAQ,OAAO;AACd,UAAI,iBAAiB,SAAS,MAAM,YAAY,qDAAqD,CAAC,KAAK,MAAM,OAAO,QAAQ;AAC9H,aAAK,MAAM,UAAU;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AClE,uBAAiB,QAAQ,mBAAmB;AAAA,QAC1C,SAAS;AAAA,QACT,WAAW;AAAA,MACnB,CAAO;AAAA,IACF;AAAA,EACF;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domHelpers.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/domHelpers.js"],"sourcesContent":["const simulatorClass = \"slice-simulator\";\nconst simulatorRootClass = \"slice-simulator--root\";\nconst getSimulatorDOM = () => {\n return document.querySelector(`.${simulatorClass}`);\n};\nconst getSimulatorRootDOM = () => {\n return document.querySelector(`.${simulatorRootClass}`);\n};\nconst getSliceZoneDOM = (expectedNumberOfChildren) => {\n let node = document.querySelector(`.${simulatorClass} [data-slice-zone]`);\n if (node) {\n if (node.children.length !== expectedNumberOfChildren) {\n console.warn(`Flagged SliceZone has an unexpected number of children, found ${node.children.length} but expected ${expectedNumberOfChildren}. This might lead to unexpected behaviors. Are you sure you tagged the right element?`);\n }\n return node;\n }\n node = document.querySelector(`.${simulatorClass} .${simulatorRootClass}`);\n if (!node) {\n return null;\n }\n const searchDepth = 5;\n for (let i = 0; i < searchDepth; i++) {\n if (node.children.length === expectedNumberOfChildren) {\n return node;\n } else if (node.children.length) {\n node = node.children[0];\n } else {\n break;\n }\n }\n return null;\n};\nconst getActiveSliceDOM = ($sliceZone, mouse) => {\n const raycast = document.elementsFromPoint(mouse.x, mouse.y).reverse();\n const sliceZoneIndex = raycast.indexOf($sliceZone);\n if (sliceZoneIndex === -1) {\n return null;\n }\n const $slice = raycast[sliceZoneIndex + 1];\n if (!$slice) {\n return null;\n }\n return $slice;\n};\nexport {\n getActiveSliceDOM,\n getSimulatorDOM,\n getSimulatorRootDOM,\n getSliceZoneDOM,\n simulatorClass,\n simulatorRootClass\n};\n//# sourceMappingURL=domHelpers.js.map\n"],"names":[],"mappings":";;AAAK,MAAC,iBAAiB;AAClB,MAAC,qBAAqB;AACtB,MAAC,kBAAkB,MAAM;AAC5B,SAAO,SAAS,cAAc,IAAI,
|
|
1
|
+
{"version":3,"file":"domHelpers.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/domHelpers.js"],"sourcesContent":["const simulatorClass = \"slice-simulator\";\nconst simulatorRootClass = \"slice-simulator--root\";\nconst getSimulatorDOM = () => {\n return document.querySelector(`.${simulatorClass}`);\n};\nconst getSimulatorRootDOM = () => {\n return document.querySelector(`.${simulatorRootClass}`);\n};\nconst getSliceZoneDOM = (expectedNumberOfChildren) => {\n let node = document.querySelector(`.${simulatorClass} [data-slice-zone]`);\n if (node) {\n if (node.children.length !== expectedNumberOfChildren) {\n console.warn(`Flagged SliceZone has an unexpected number of children, found ${node.children.length} but expected ${expectedNumberOfChildren}. This might lead to unexpected behaviors. Are you sure you tagged the right element?`);\n }\n return node;\n }\n node = document.querySelector(`.${simulatorClass} .${simulatorRootClass}`);\n if (!node) {\n return null;\n }\n const searchDepth = 5;\n for (let i = 0; i < searchDepth; i++) {\n if (node.children.length === expectedNumberOfChildren) {\n return node;\n } else if (node.children.length) {\n node = node.children[0];\n } else {\n break;\n }\n }\n return null;\n};\nconst getActiveSliceDOM = ($sliceZone, mouse) => {\n const raycast = document.elementsFromPoint(mouse.x, mouse.y).reverse();\n const sliceZoneIndex = raycast.indexOf($sliceZone);\n if (sliceZoneIndex === -1) {\n return null;\n }\n const $slice = raycast[sliceZoneIndex + 1];\n if (!$slice) {\n return null;\n }\n return $slice;\n};\nexport {\n getActiveSliceDOM,\n getSimulatorDOM,\n getSimulatorRootDOM,\n getSliceZoneDOM,\n simulatorClass,\n simulatorRootClass\n};\n//# sourceMappingURL=domHelpers.js.map\n"],"names":[],"mappings":";;AAAK,MAAC,iBAAiB;AAClB,MAAC,qBAAqB;AACtB,MAAC,kBAAkB,MAAM;AAC5B,SAAO,SAAS,cAAc,IAAI,cAAc,EAAE;AACpD;AACK,MAAC,sBAAsB,MAAM;AAChC,SAAO,SAAS,cAAc,IAAI,kBAAkB,EAAE;AACxD;AACK,MAAC,kBAAkB,CAAC,6BAA6B;AACpD,MAAI,OAAO,SAAS,cAAc,IAAI,cAAc,oBAAoB;AACxE,MAAI,MAAM;AACR,QAAI,KAAK,SAAS,WAAW,0BAA0B;AACrD,cAAQ,KAAK,iEAAiE,KAAK,SAAS,MAAM,iBAAiB,wBAAwB,uFAAuF;AAAA,IACnO;AACD,WAAO;AAAA,EACR;AACD,SAAO,SAAS,cAAc,IAAI,cAAc,KAAK,kBAAkB,EAAE;AACzE,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACR;AACD,QAAM,cAAc;AACpB,WAAS,IAAI,GAAG,IAAI,aAAa,KAAK;AACpC,QAAI,KAAK,SAAS,WAAW,0BAA0B;AACrD,aAAO;AAAA,IACb,WAAe,KAAK,SAAS,QAAQ;AAC/B,aAAO,KAAK,SAAS,CAAC;AAAA,IAC5B,OAAW;AACL;AAAA,IACD;AAAA,EACF;AACD,SAAO;AACT;AACK,MAAC,oBAAoB,CAAC,YAAY,UAAU;AAC/C,QAAM,UAAU,SAAS,kBAAkB,MAAM,GAAG,MAAM,CAAC,EAAE;AAC7D,QAAM,iBAAiB,QAAQ,QAAQ,UAAU;AACjD,MAAI,mBAAmB,IAAI;AACzB,WAAO;AAAA,EACR;AACD,QAAM,SAAS,QAAQ,iBAAiB,CAAC;AACzC,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACR;AACD,SAAO;AACT;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domHelpers.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/domHelpers.js"],"sourcesContent":["const simulatorClass = \"slice-simulator\";\nconst simulatorRootClass = \"slice-simulator--root\";\nconst getSimulatorDOM = () => {\n return document.querySelector(`.${simulatorClass}`);\n};\nconst getSimulatorRootDOM = () => {\n return document.querySelector(`.${simulatorRootClass}`);\n};\nconst getSliceZoneDOM = (expectedNumberOfChildren) => {\n let node = document.querySelector(`.${simulatorClass} [data-slice-zone]`);\n if (node) {\n if (node.children.length !== expectedNumberOfChildren) {\n console.warn(`Flagged SliceZone has an unexpected number of children, found ${node.children.length} but expected ${expectedNumberOfChildren}. This might lead to unexpected behaviors. Are you sure you tagged the right element?`);\n }\n return node;\n }\n node = document.querySelector(`.${simulatorClass} .${simulatorRootClass}`);\n if (!node) {\n return null;\n }\n const searchDepth = 5;\n for (let i = 0; i < searchDepth; i++) {\n if (node.children.length === expectedNumberOfChildren) {\n return node;\n } else if (node.children.length) {\n node = node.children[0];\n } else {\n break;\n }\n }\n return null;\n};\nconst getActiveSliceDOM = ($sliceZone, mouse) => {\n const raycast = document.elementsFromPoint(mouse.x, mouse.y).reverse();\n const sliceZoneIndex = raycast.indexOf($sliceZone);\n if (sliceZoneIndex === -1) {\n return null;\n }\n const $slice = raycast[sliceZoneIndex + 1];\n if (!$slice) {\n return null;\n }\n return $slice;\n};\nexport {\n getActiveSliceDOM,\n getSimulatorDOM,\n getSimulatorRootDOM,\n getSliceZoneDOM,\n simulatorClass,\n simulatorRootClass\n};\n//# sourceMappingURL=domHelpers.js.map\n"],"names":[],"mappings":"AAAK,MAAC,iBAAiB;AAClB,MAAC,qBAAqB;AACtB,MAAC,kBAAkB,MAAM;AAC5B,SAAO,SAAS,cAAc,IAAI,
|
|
1
|
+
{"version":3,"file":"domHelpers.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/domHelpers.js"],"sourcesContent":["const simulatorClass = \"slice-simulator\";\nconst simulatorRootClass = \"slice-simulator--root\";\nconst getSimulatorDOM = () => {\n return document.querySelector(`.${simulatorClass}`);\n};\nconst getSimulatorRootDOM = () => {\n return document.querySelector(`.${simulatorRootClass}`);\n};\nconst getSliceZoneDOM = (expectedNumberOfChildren) => {\n let node = document.querySelector(`.${simulatorClass} [data-slice-zone]`);\n if (node) {\n if (node.children.length !== expectedNumberOfChildren) {\n console.warn(`Flagged SliceZone has an unexpected number of children, found ${node.children.length} but expected ${expectedNumberOfChildren}. This might lead to unexpected behaviors. Are you sure you tagged the right element?`);\n }\n return node;\n }\n node = document.querySelector(`.${simulatorClass} .${simulatorRootClass}`);\n if (!node) {\n return null;\n }\n const searchDepth = 5;\n for (let i = 0; i < searchDepth; i++) {\n if (node.children.length === expectedNumberOfChildren) {\n return node;\n } else if (node.children.length) {\n node = node.children[0];\n } else {\n break;\n }\n }\n return null;\n};\nconst getActiveSliceDOM = ($sliceZone, mouse) => {\n const raycast = document.elementsFromPoint(mouse.x, mouse.y).reverse();\n const sliceZoneIndex = raycast.indexOf($sliceZone);\n if (sliceZoneIndex === -1) {\n return null;\n }\n const $slice = raycast[sliceZoneIndex + 1];\n if (!$slice) {\n return null;\n }\n return $slice;\n};\nexport {\n getActiveSliceDOM,\n getSimulatorDOM,\n getSimulatorRootDOM,\n getSliceZoneDOM,\n simulatorClass,\n simulatorRootClass\n};\n//# sourceMappingURL=domHelpers.js.map\n"],"names":[],"mappings":"AAAK,MAAC,iBAAiB;AAClB,MAAC,qBAAqB;AACtB,MAAC,kBAAkB,MAAM;AAC5B,SAAO,SAAS,cAAc,IAAI,cAAc,EAAE;AACpD;AACK,MAAC,sBAAsB,MAAM;AAChC,SAAO,SAAS,cAAc,IAAI,kBAAkB,EAAE;AACxD;AACK,MAAC,kBAAkB,CAAC,6BAA6B;AACpD,MAAI,OAAO,SAAS,cAAc,IAAI,cAAc,oBAAoB;AACxE,MAAI,MAAM;AACR,QAAI,KAAK,SAAS,WAAW,0BAA0B;AACrD,cAAQ,KAAK,iEAAiE,KAAK,SAAS,MAAM,iBAAiB,wBAAwB,uFAAuF;AAAA,IACnO;AACD,WAAO;AAAA,EACR;AACD,SAAO,SAAS,cAAc,IAAI,cAAc,KAAK,kBAAkB,EAAE;AACzE,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACR;AACD,QAAM,cAAc;AACpB,WAAS,IAAI,GAAG,IAAI,aAAa,KAAK;AACpC,QAAI,KAAK,SAAS,WAAW,0BAA0B;AACrD,aAAO;AAAA,IACb,WAAe,KAAK,SAAS,QAAQ;AAC/B,aAAO,KAAK,SAAS,CAAC;AAAA,IAC5B,OAAW;AACL;AAAA,IACD;AAAA,EACF;AACD,SAAO;AACT;AACK,MAAC,oBAAoB,CAAC,YAAY,UAAU;AAC/C,QAAM,UAAU,SAAS,kBAAkB,MAAM,GAAG,MAAM,CAAC,EAAE;AAC7D,QAAM,iBAAiB,QAAQ,QAAQ,UAAU;AACjD,MAAI,mBAAmB,IAAI;AACzB,WAAO;AAAA,EACR;AACD,QAAM,SAAS,QAAQ,iBAAiB,CAAC;AACzC,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACR;AACD,SAAO;AACT;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/messages.js"],"sourcesContent":["const div = (content) => `<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\nconst a = (href, label) => `<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\nconst header = \" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\nconst footer = \"\\n\\n\\n\\n\\n\\n - The Prismic team\";\nconst sliceSimulatorAccessedDirectly = div([\n header,\n `You're seeing this page because you're accessing Slice simulator\ndirectly, e.g:\n\n - ${a(\"http://localhost:3000/slice-simulator\")}\n\n\n\nThe Slice simulator can only be accessed through Slice Machine or the\nPage Builder. To preview your Slices, head over to Slice Machine:\n\n - ${a(\"http://localhost:9999\")}\n\n\n\nIf you believe this is an error, please reach out to us:\n\n - ${a(\"https://github.com/prismicio/slice-machine/issues/new/choose\")}`,\n footer\n].join(\"\"));\nexport {\n sliceSimulatorAccessedDirectly\n};\n//# sourceMappingURL=messages.js.map\n"],"names":[],"mappings":";;AAAA,MAAM,MAAM,CAAC,YAAY,mLAAmL;
|
|
1
|
+
{"version":3,"file":"messages.cjs","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/messages.js"],"sourcesContent":["const div = (content) => `<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\nconst a = (href, label) => `<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\nconst header = \" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\nconst footer = \"\\n\\n\\n\\n\\n\\n - The Prismic team\";\nconst sliceSimulatorAccessedDirectly = div([\n header,\n `You're seeing this page because you're accessing Slice simulator\ndirectly, e.g:\n\n - ${a(\"http://localhost:3000/slice-simulator\")}\n\n\n\nThe Slice simulator can only be accessed through Slice Machine or the\nPage Builder. To preview your Slices, head over to Slice Machine:\n\n - ${a(\"http://localhost:9999\")}\n\n\n\nIf you believe this is an error, please reach out to us:\n\n - ${a(\"https://github.com/prismicio/slice-machine/issues/new/choose\")}`,\n footer\n].join(\"\"));\nexport {\n sliceSimulatorAccessedDirectly\n};\n//# sourceMappingURL=messages.js.map\n"],"names":[],"mappings":";;AAAA,MAAM,MAAM,CAAC,YAAY,mLAAmL,OAAO;AACnN,MAAM,IAAI,CAAC,MAAM,UAAU,YAAY,IAAI,yCAAyC,SAAS,IAAI;AACjG,MAAM,SAAS;AACf,MAAM,SAAS;AACV,MAAC,iCAAiC,IAAI;AAAA,EACzC;AAAA,EACA;AAAA;AAAA;AAAA,MAGI,EAAE,uCAAuC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAO1C,EAAE,uBAAuB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAM1B,EAAE,8DAA8D,CAAC;AAAA,EACrE;AACF,EAAE,KAAK,EAAE,CAAC;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/messages.js"],"sourcesContent":["const div = (content) => `<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\nconst a = (href, label) => `<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\nconst header = \" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\nconst footer = \"\\n\\n\\n\\n\\n\\n - The Prismic team\";\nconst sliceSimulatorAccessedDirectly = div([\n header,\n `You're seeing this page because you're accessing Slice simulator\ndirectly, e.g:\n\n - ${a(\"http://localhost:3000/slice-simulator\")}\n\n\n\nThe Slice simulator can only be accessed through Slice Machine or the\nPage Builder. To preview your Slices, head over to Slice Machine:\n\n - ${a(\"http://localhost:9999\")}\n\n\n\nIf you believe this is an error, please reach out to us:\n\n - ${a(\"https://github.com/prismicio/slice-machine/issues/new/choose\")}`,\n footer\n].join(\"\"));\nexport {\n sliceSimulatorAccessedDirectly\n};\n//# sourceMappingURL=messages.js.map\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,CAAC,YAAY,mLAAmL;
|
|
1
|
+
{"version":3,"file":"messages.js","sources":["../../../../../../../../node_modules/@prismicio/simulator/dist/kit/messages.js"],"sourcesContent":["const div = (content) => `<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\nconst a = (href, label) => `<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\nconst header = \" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\nconst footer = \"\\n\\n\\n\\n\\n\\n - The Prismic team\";\nconst sliceSimulatorAccessedDirectly = div([\n header,\n `You're seeing this page because you're accessing Slice simulator\ndirectly, e.g:\n\n - ${a(\"http://localhost:3000/slice-simulator\")}\n\n\n\nThe Slice simulator can only be accessed through Slice Machine or the\nPage Builder. To preview your Slices, head over to Slice Machine:\n\n - ${a(\"http://localhost:9999\")}\n\n\n\nIf you believe this is an error, please reach out to us:\n\n - ${a(\"https://github.com/prismicio/slice-machine/issues/new/choose\")}`,\n footer\n].join(\"\"));\nexport {\n sliceSimulatorAccessedDirectly\n};\n//# sourceMappingURL=messages.js.map\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,CAAC,YAAY,mLAAmL,OAAO;AACnN,MAAM,IAAI,CAAC,MAAM,UAAU,YAAY,IAAI,yCAAyC,SAAS,IAAI;AACjG,MAAM,SAAS;AACf,MAAM,SAAS;AACV,MAAC,iCAAiC,IAAI;AAAA,EACzC;AAAA,EACA;AAAA;AAAA;AAAA,MAGI,EAAE,uCAAuC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAO1C,EAAE,uBAAuB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAM1B,EAAE,8DAA8D,CAAC;AAAA,EACrE;AACF,EAAE,KAAK,EAAE,CAAC;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentation-read.cjs","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"_uid\" : model.id}.vue`;\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic, params }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getByUID(\"${model.id}\", params.uid);\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getSingle(\"${model.id}\");\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Options API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":["stripIndent","source"],"mappings":";;;;;;AAAA,IAAA,IAAA;AAMO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACC,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"documentation-read.cjs","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"_uid\" : model.id}.vue`;\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic, params }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getByUID(\"${model.id}\", params.uid);\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getSingle(\"${model.id}\");\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Options API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":["stripIndent","source"],"mappings":";;;;;;AAAA,IAAA,IAAA;AAMO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACC,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,SAAS,MAAM,EAAE;AAEpD,QAAA;AAEJ,QAAI,MAAM,YAAY;AACP,oBAAAA,WAAA,YAAA,OAAA,KAAW,WAU8B,CAAA,iSAAA,8WAAA,CAAA,IAAR,MAAM,EAAA;AAAA,IAAA,OAoB/C;AACQ,oBAAAA,WAAA,YAAA,OAAA,KAAW,WAU+B,CAAA,0RAAA,kWAAA,CAAA,IAAR,MAAM,EAAA;AAAA,IAoBvD;AAEA,QAAI,QAAQ,QAAQ;AACnB,oBAAc,MAAM,QAAQ,OAC3B,aACA,QAAQ,iBAAiB,WAAW,GACpC;AAAA,QACC,UAAU,EAAE,QAAQ,MAAO;AAAA,QAC3B,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEO,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAASC,WAAAA;AAAAA,sBACS,MAAM,KAAK;AAAA;AAAA,gDAEe,QAAQ,kIAAkI,QAAQ;AAAA;AAAA;AAAA;AAAA,OAI3L,mBAAmB,QAAQ;AAAA,EAAM,WAAW;AAAA,IAAO;AAAA;AAAA;AAAA;AAAA,MAItD;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentation-read.js","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"_uid\" : model.id}.vue`;\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic, params }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getByUID(\"${model.id}\", params.uid);\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getSingle(\"${model.id}\");\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Options API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":[],"mappings":";;;;AAAA,IAAA,IAAA;AAMO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACC,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"documentation-read.js","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"_uid\" : model.id}.vue`;\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic, params }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getByUID(\"${model.id}\", params.uid);\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone :slices=\"page.data.slices\" :components=\"components\" />\n\t\t\t\t</template>\n\n\t\t\t\t<script>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\texport default {\n\t\t\t\t\tasync asyncData({ $prismic }) {\n\t\t\t\t\t\tconst page = await $prismic.api.getSingle(\"${model.id}\");\n\n\t\t\t\t\t\treturn { page };\n\t\t\t\t\t},\n\t\t\t\t\tdata() {\n\t\t\t\t\t\treturn { components };\n\t\t\t\t\t},\n\t\t\t\t\thead() {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: this.page.data.meta_title,\n\t\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\t\thid: \"description\",\n\t\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\t\tcontent: this.page.data.meta_description,\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Options API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":[],"mappings":";;;;AAAA,IAAA,IAAA;AAMO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACC,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,SAAS,MAAM,EAAE;AAEpD,QAAA;AAEJ,QAAI,MAAM,YAAY;AACP,oBAAA,YAAA,OAAA,KAAW,WAU8B,CAAA,iSAAA,8WAAA,CAAA,IAAR,MAAM,EAAA;AAAA,IAAA,OAoB/C;AACQ,oBAAA,YAAA,OAAA,KAAW,WAU+B,CAAA,0RAAA,kWAAA,CAAA,IAAR,MAAM,EAAA;AAAA,IAoBvD;AAEA,QAAI,QAAQ,QAAQ;AACnB,oBAAc,MAAM,QAAQ,OAC3B,aACA,QAAQ,iBAAiB,WAAW,GACpC;AAAA,QACC,UAAU,EAAE,QAAQ,MAAO;AAAA,QAC3B,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEO,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAAS;AAAA,sBACS,MAAM,KAAK;AAAA;AAAA,gDAEe,QAAQ,kIAAkI,QAAQ;AAAA;AAAA;AAAA;AAAA,OAI3L,mBAAmB,QAAQ;AAAA,EAAM,WAAW;AAAA,IAAO;AAAA;AAAA;AAAA;AAAA,MAItD;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-init.cjs","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tcheckHasProjectFile,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport { builders, loadFile, writeFile } from \"magicast\";\n\nimport { buildSrcPath } from \"../lib/buildSrcPath\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst NUXT_PRISMIC = \"@nuxtjs/prismic\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t[NUXT_PRISMIC]: \"^1.4.2\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype ConfigurePrismicModuleArgs = SliceMachineContext<PluginOptions>;\n\nconst configurePrismicModule = async ({\n\thelpers,\n\tproject,\n}: ConfigurePrismicModuleArgs) => {\n\tlet nuxtConfigFilename = \"nuxt.config.js\";\n\n\tif (!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))) {\n\t\tnuxtConfigFilename = \"nuxt.config.ts\";\n\n\t\t// nuxt.config.* not found\n\t\tif (\n\t\t\t!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst nuxtConfigPath = helpers.joinPathFromRoot(nuxtConfigFilename);\n\n\tconst mod = await loadFile(nuxtConfigPath);\n\n\tconst endpoint =\n\t\tproject.config.apiEndpoint ||\n\t\t`https://${project.config.repositoryName}.cdn.prismic.io/api/v2`;\n\n\tlet config;\n\ttry {\n\t\tconfig =\n\t\t\tmod.exports.default.$type === \"function-call\"\n\t\t\t\t? mod.exports.default.$args[0]\n\t\t\t\t: mod.exports.default;\n\t} catch {\n\t\tconst errorMessage = `Failed to update ${path.basename(nuxtConfigPath)}`;\n\t\tconsole.error(errorMessage);\n\t\tconsole.warn(\n\t\t\t`Ensure that the following has been added to ${path.basename(\n\t\t\t\tnuxtConfigPath,\n\t\t\t)}.`,\n\t\t);\n\t\tconsole.warn(stripIndent`\n\t\t\t{\n\t\t\t\tbuildModules: [\"@nuxtjs/prismic\"],\n\t\t\t\tprismic: {\n\t\t\t\t\tendpoint: \"${endpoint}\",\n\t\t\t\t\tmodern: true\n\t\t\t\t}\n\t\t\t}\n\t\t`);\n\n\t\tthrow errorMessage;\n\t}\n\n\t// Register Prismic module\n\tlet hasInlinedConfiguration = false;\n\tconst hasPrismicModuleRegistered = !![\n\t\t...(config.modules || []),\n\t\t...(config.buildModules || []),\n\t].find((registration: string | [string, unknown]) => {\n\t\tif (typeof registration === \"string\") {\n\t\t\treturn registration === NUXT_PRISMIC;\n\t\t} else if (Array.isArray(registration)) {\n\t\t\thasInlinedConfiguration = !!registration[1];\n\n\t\t\treturn registration[0] === NUXT_PRISMIC;\n\t\t}\n\n\t\treturn false;\n\t});\n\n\tif (!hasPrismicModuleRegistered) {\n\t\tconfig.buildModules ||= [];\n\t\tconfig.buildModules.push(NUXT_PRISMIC);\n\t}\n\n\t// Append Prismic module configuration\n\tif (!hasInlinedConfiguration) {\n\t\t// Import Slice Machine configuration\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"apiEndpoint\",\n\t\t});\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"repositoryName\",\n\t\t});\n\n\t\t// Add inline configuration\n\t\tif (config.prismic) {\n\t\t\tconfig.prismic.endpoint = builders.raw(\"apiEndpoint || repositoryName\");\n\t\t} else {\n\t\t\tconfig.prismic = {\n\t\t\t\tendpoint: builders.raw(\"apiEndpoint || repositoryName\"),\n\t\t\t\tmodern: true,\n\t\t\t};\n\t\t}\n\t}\n\n\tawait writeFile(mod, nuxtConfigPath);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst filename = await buildSrcPath({\n\t\tfilename: path.join(\"pages\", \"slice-simulator.vue\"),\n\t\thelpers,\n\t});\n\n\tif (await checkHasProjectFile({ filename, helpers })) {\n\t\treturn;\n\t}\n\n\tconst contents = stripIndent`\n\t\t<template>\n\t\t\t<SliceSimulator v-slot=\"{ slices }\">\n\t\t\t\t<SliceZone :slices=\"slices\" :components=\"components\" />\n\t\t\t</SliceSimulator>\n\t\t</template>\n\n\t\t<script>\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-nuxt2/dist/simulator.cjs\";\n\t\timport { components } from \"~/slices\";\n\n\t\texport default {\n\t\t\tcomponents: {\n\t\t\t\tSliceSimulator,\n\t\t\t},\n\t\t\tdata () {\n\t\t\t\treturn { components };\n\t\t\t},\n\t\t};\n\t\t</script>\n\t`;\n\n\tawait writeProjectFile({\n\t\tfilename,\n\t\tcontents,\n\t\tformat: options.format,\n\t\thelpers,\n\t});\n};\n\nconst modifySliceMachineConfig = async ({\n\thelpers,\n\toptions,\n\tactions,\n}: SliceMachineContext<PluginOptions>) => {\n\tconst hasSrcDirectory = await checkHasProjectFile({\n\t\tfilename: \"src\",\n\t\thelpers,\n\t});\n\tconst project = await helpers.getProject();\n\n\t// Add Slice Simulator URL.\n\tproject.config.localSliceSimulatorURL ||=\n\t\t\"http://localhost:3000/slice-simulator\";\n\n\t// Nest the default Slice Library in the src directory if it exists and\n\t// is empty.\n\tif (\n\t\thasSrcDirectory &&\n\t\tproject.config.libraries &&\n\t\tJSON.stringify(project.config.libraries) === JSON.stringify([\"./slices\"])\n\t) {\n\t\tconst sliceLibrary = await actions.readSliceLibrary({\n\t\t\tlibraryID: project.config.libraries[0],\n\t\t});\n\n\t\tif (sliceLibrary.sliceIDs.length < 1) {\n\t\t\tproject.config.libraries = [\"./src/slices\"];\n\t\t}\n\t}\n\n\tawait helpers.updateSliceMachineConfig(project.config, {\n\t\tformat: options.format,\n\t});\n};\n\nexport const projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tinstallDependencies({ installDependencies: _installDependencies }),\n\t\t\tconfigurePrismicModule(context),\n\t\t\tcreateSliceSimulatorPage(context),\n\t\t\tmodifySliceMachineConfig(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies","checkHasProjectFile","loadFile","path","stripIndent","builders","writeFile","buildSrcPath","writeProjectFile","_a","rejectIfNecessary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AAkBA,MAAM,eAAe;AAMrB,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,CAAC,YAAY,GAAG;AAAA,IAChB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,yBAAyB,OAAO,EACrC,SACA,cACgC;AAChC,MAAI,qBAAqB;AAErB,MAAA,CAAE,MAAMC,GAAAA,oBAAoB,EAAE,UAAU,oBAAoB,QAAA,CAAS,GAAI;AACvD,yBAAA;AAIpB,QAAA,CAAE,MAAMA,GAAAA,oBAAoB,EAAE,UAAU,oBAAoB,QAAA,CAAS,GACpE;AACD;AAAA,IACD;AAAA,EACD;AAEM,QAAA,iBAAiB,QAAQ,iBAAiB,kBAAkB;AAE5D,QAAA,MAAM,MAAMC,kBAAS,cAAc;AAEzC,QAAM,WACL,QAAQ,OAAO,eACf,WAAW,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"file":"project-init.cjs","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tcheckHasProjectFile,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport { builders, loadFile, writeFile } from \"magicast\";\n\nimport { buildSrcPath } from \"../lib/buildSrcPath\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst NUXT_PRISMIC = \"@nuxtjs/prismic\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t[NUXT_PRISMIC]: \"^1.4.2\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype ConfigurePrismicModuleArgs = SliceMachineContext<PluginOptions>;\n\nconst configurePrismicModule = async ({\n\thelpers,\n\tproject,\n}: ConfigurePrismicModuleArgs) => {\n\tlet nuxtConfigFilename = \"nuxt.config.js\";\n\n\tif (!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))) {\n\t\tnuxtConfigFilename = \"nuxt.config.ts\";\n\n\t\t// nuxt.config.* not found\n\t\tif (\n\t\t\t!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst nuxtConfigPath = helpers.joinPathFromRoot(nuxtConfigFilename);\n\n\tconst mod = await loadFile(nuxtConfigPath);\n\n\tconst endpoint =\n\t\tproject.config.apiEndpoint ||\n\t\t`https://${project.config.repositoryName}.cdn.prismic.io/api/v2`;\n\n\tlet config;\n\ttry {\n\t\tconfig =\n\t\t\tmod.exports.default.$type === \"function-call\"\n\t\t\t\t? mod.exports.default.$args[0]\n\t\t\t\t: mod.exports.default;\n\t} catch {\n\t\tconst errorMessage = `Failed to update ${path.basename(nuxtConfigPath)}`;\n\t\tconsole.error(errorMessage);\n\t\tconsole.warn(\n\t\t\t`Ensure that the following has been added to ${path.basename(\n\t\t\t\tnuxtConfigPath,\n\t\t\t)}.`,\n\t\t);\n\t\tconsole.warn(stripIndent`\n\t\t\t{\n\t\t\t\tbuildModules: [\"@nuxtjs/prismic\"],\n\t\t\t\tprismic: {\n\t\t\t\t\tendpoint: \"${endpoint}\",\n\t\t\t\t\tmodern: true\n\t\t\t\t}\n\t\t\t}\n\t\t`);\n\n\t\tthrow errorMessage;\n\t}\n\n\t// Register Prismic module\n\tlet hasInlinedConfiguration = false;\n\tconst hasPrismicModuleRegistered = !![\n\t\t...(config.modules || []),\n\t\t...(config.buildModules || []),\n\t].find((registration: string | [string, unknown]) => {\n\t\tif (typeof registration === \"string\") {\n\t\t\treturn registration === NUXT_PRISMIC;\n\t\t} else if (Array.isArray(registration)) {\n\t\t\thasInlinedConfiguration = !!registration[1];\n\n\t\t\treturn registration[0] === NUXT_PRISMIC;\n\t\t}\n\n\t\treturn false;\n\t});\n\n\tif (!hasPrismicModuleRegistered) {\n\t\tconfig.buildModules ||= [];\n\t\tconfig.buildModules.push(NUXT_PRISMIC);\n\t}\n\n\t// Append Prismic module configuration\n\tif (!hasInlinedConfiguration) {\n\t\t// Import Slice Machine configuration\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"apiEndpoint\",\n\t\t});\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"repositoryName\",\n\t\t});\n\n\t\t// Add inline configuration\n\t\tif (config.prismic) {\n\t\t\tconfig.prismic.endpoint = builders.raw(\"apiEndpoint || repositoryName\");\n\t\t} else {\n\t\t\tconfig.prismic = {\n\t\t\t\tendpoint: builders.raw(\"apiEndpoint || repositoryName\"),\n\t\t\t\tmodern: true,\n\t\t\t};\n\t\t}\n\t}\n\n\tawait writeFile(mod, nuxtConfigPath);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst filename = await buildSrcPath({\n\t\tfilename: path.join(\"pages\", \"slice-simulator.vue\"),\n\t\thelpers,\n\t});\n\n\tif (await checkHasProjectFile({ filename, helpers })) {\n\t\treturn;\n\t}\n\n\tconst contents = stripIndent`\n\t\t<template>\n\t\t\t<SliceSimulator v-slot=\"{ slices }\">\n\t\t\t\t<SliceZone :slices=\"slices\" :components=\"components\" />\n\t\t\t</SliceSimulator>\n\t\t</template>\n\n\t\t<script>\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-nuxt2/dist/simulator.cjs\";\n\t\timport { components } from \"~/slices\";\n\n\t\texport default {\n\t\t\tcomponents: {\n\t\t\t\tSliceSimulator,\n\t\t\t},\n\t\t\tdata () {\n\t\t\t\treturn { components };\n\t\t\t},\n\t\t};\n\t\t</script>\n\t`;\n\n\tawait writeProjectFile({\n\t\tfilename,\n\t\tcontents,\n\t\tformat: options.format,\n\t\thelpers,\n\t});\n};\n\nconst modifySliceMachineConfig = async ({\n\thelpers,\n\toptions,\n\tactions,\n}: SliceMachineContext<PluginOptions>) => {\n\tconst hasSrcDirectory = await checkHasProjectFile({\n\t\tfilename: \"src\",\n\t\thelpers,\n\t});\n\tconst project = await helpers.getProject();\n\n\t// Add Slice Simulator URL.\n\tproject.config.localSliceSimulatorURL ||=\n\t\t\"http://localhost:3000/slice-simulator\";\n\n\t// Nest the default Slice Library in the src directory if it exists and\n\t// is empty.\n\tif (\n\t\thasSrcDirectory &&\n\t\tproject.config.libraries &&\n\t\tJSON.stringify(project.config.libraries) === JSON.stringify([\"./slices\"])\n\t) {\n\t\tconst sliceLibrary = await actions.readSliceLibrary({\n\t\t\tlibraryID: project.config.libraries[0],\n\t\t});\n\n\t\tif (sliceLibrary.sliceIDs.length < 1) {\n\t\t\tproject.config.libraries = [\"./src/slices\"];\n\t\t}\n\t}\n\n\tawait helpers.updateSliceMachineConfig(project.config, {\n\t\tformat: options.format,\n\t});\n};\n\nexport const projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tinstallDependencies({ installDependencies: _installDependencies }),\n\t\t\tconfigurePrismicModule(context),\n\t\t\tcreateSliceSimulatorPage(context),\n\t\t\tmodifySliceMachineConfig(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies","checkHasProjectFile","loadFile","path","stripIndent","builders","writeFile","buildSrcPath","writeProjectFile","_a","rejectIfNecessary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AAkBA,MAAM,eAAe;AAMrB,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,CAAC,YAAY,GAAG;AAAA,IAChB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,yBAAyB,OAAO,EACrC,SACA,cACgC;AAChC,MAAI,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AS,GAAG;AAC7B,cAAA,OAAO,YAAY,CAAC,cAAc;AAAA,IAC3C;AAAA,EACD;AAEM,QAAA,QAAQ,yBAAyB,QAAQ,QAAQ;AAAA,IACtD,QAAQ,QAAQ;AAAA,EAAA,CAChB;AACF;AAEO,MAAM,cAA8C,OAC1D,EAAE,qBAAqB,qBAAA,GACvB,YACG;AAEFC,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,oBAAoB,EAAE,qBAAqB,sBAAsB;AAAA,IACjE,uBAAuB,OAAO;AAAA,IAC9B,yBAAyB,OAAO;AAAA,IAChC,yBAAyB,OAAO;AAAA,EAChC,CAAA,CAAC;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-init.js","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tcheckHasProjectFile,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport { builders, loadFile, writeFile } from \"magicast\";\n\nimport { buildSrcPath } from \"../lib/buildSrcPath\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst NUXT_PRISMIC = \"@nuxtjs/prismic\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t[NUXT_PRISMIC]: \"^1.4.2\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype ConfigurePrismicModuleArgs = SliceMachineContext<PluginOptions>;\n\nconst configurePrismicModule = async ({\n\thelpers,\n\tproject,\n}: ConfigurePrismicModuleArgs) => {\n\tlet nuxtConfigFilename = \"nuxt.config.js\";\n\n\tif (!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))) {\n\t\tnuxtConfigFilename = \"nuxt.config.ts\";\n\n\t\t// nuxt.config.* not found\n\t\tif (\n\t\t\t!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst nuxtConfigPath = helpers.joinPathFromRoot(nuxtConfigFilename);\n\n\tconst mod = await loadFile(nuxtConfigPath);\n\n\tconst endpoint =\n\t\tproject.config.apiEndpoint ||\n\t\t`https://${project.config.repositoryName}.cdn.prismic.io/api/v2`;\n\n\tlet config;\n\ttry {\n\t\tconfig =\n\t\t\tmod.exports.default.$type === \"function-call\"\n\t\t\t\t? mod.exports.default.$args[0]\n\t\t\t\t: mod.exports.default;\n\t} catch {\n\t\tconst errorMessage = `Failed to update ${path.basename(nuxtConfigPath)}`;\n\t\tconsole.error(errorMessage);\n\t\tconsole.warn(\n\t\t\t`Ensure that the following has been added to ${path.basename(\n\t\t\t\tnuxtConfigPath,\n\t\t\t)}.`,\n\t\t);\n\t\tconsole.warn(stripIndent`\n\t\t\t{\n\t\t\t\tbuildModules: [\"@nuxtjs/prismic\"],\n\t\t\t\tprismic: {\n\t\t\t\t\tendpoint: \"${endpoint}\",\n\t\t\t\t\tmodern: true\n\t\t\t\t}\n\t\t\t}\n\t\t`);\n\n\t\tthrow errorMessage;\n\t}\n\n\t// Register Prismic module\n\tlet hasInlinedConfiguration = false;\n\tconst hasPrismicModuleRegistered = !![\n\t\t...(config.modules || []),\n\t\t...(config.buildModules || []),\n\t].find((registration: string | [string, unknown]) => {\n\t\tif (typeof registration === \"string\") {\n\t\t\treturn registration === NUXT_PRISMIC;\n\t\t} else if (Array.isArray(registration)) {\n\t\t\thasInlinedConfiguration = !!registration[1];\n\n\t\t\treturn registration[0] === NUXT_PRISMIC;\n\t\t}\n\n\t\treturn false;\n\t});\n\n\tif (!hasPrismicModuleRegistered) {\n\t\tconfig.buildModules ||= [];\n\t\tconfig.buildModules.push(NUXT_PRISMIC);\n\t}\n\n\t// Append Prismic module configuration\n\tif (!hasInlinedConfiguration) {\n\t\t// Import Slice Machine configuration\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"apiEndpoint\",\n\t\t});\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"repositoryName\",\n\t\t});\n\n\t\t// Add inline configuration\n\t\tif (config.prismic) {\n\t\t\tconfig.prismic.endpoint = builders.raw(\"apiEndpoint || repositoryName\");\n\t\t} else {\n\t\t\tconfig.prismic = {\n\t\t\t\tendpoint: builders.raw(\"apiEndpoint || repositoryName\"),\n\t\t\t\tmodern: true,\n\t\t\t};\n\t\t}\n\t}\n\n\tawait writeFile(mod, nuxtConfigPath);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst filename = await buildSrcPath({\n\t\tfilename: path.join(\"pages\", \"slice-simulator.vue\"),\n\t\thelpers,\n\t});\n\n\tif (await checkHasProjectFile({ filename, helpers })) {\n\t\treturn;\n\t}\n\n\tconst contents = stripIndent`\n\t\t<template>\n\t\t\t<SliceSimulator v-slot=\"{ slices }\">\n\t\t\t\t<SliceZone :slices=\"slices\" :components=\"components\" />\n\t\t\t</SliceSimulator>\n\t\t</template>\n\n\t\t<script>\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-nuxt2/dist/simulator.cjs\";\n\t\timport { components } from \"~/slices\";\n\n\t\texport default {\n\t\t\tcomponents: {\n\t\t\t\tSliceSimulator,\n\t\t\t},\n\t\t\tdata () {\n\t\t\t\treturn { components };\n\t\t\t},\n\t\t};\n\t\t</script>\n\t`;\n\n\tawait writeProjectFile({\n\t\tfilename,\n\t\tcontents,\n\t\tformat: options.format,\n\t\thelpers,\n\t});\n};\n\nconst modifySliceMachineConfig = async ({\n\thelpers,\n\toptions,\n\tactions,\n}: SliceMachineContext<PluginOptions>) => {\n\tconst hasSrcDirectory = await checkHasProjectFile({\n\t\tfilename: \"src\",\n\t\thelpers,\n\t});\n\tconst project = await helpers.getProject();\n\n\t// Add Slice Simulator URL.\n\tproject.config.localSliceSimulatorURL ||=\n\t\t\"http://localhost:3000/slice-simulator\";\n\n\t// Nest the default Slice Library in the src directory if it exists and\n\t// is empty.\n\tif (\n\t\thasSrcDirectory &&\n\t\tproject.config.libraries &&\n\t\tJSON.stringify(project.config.libraries) === JSON.stringify([\"./slices\"])\n\t) {\n\t\tconst sliceLibrary = await actions.readSliceLibrary({\n\t\t\tlibraryID: project.config.libraries[0],\n\t\t});\n\n\t\tif (sliceLibrary.sliceIDs.length < 1) {\n\t\t\tproject.config.libraries = [\"./src/slices\"];\n\t\t}\n\t}\n\n\tawait helpers.updateSliceMachineConfig(project.config, {\n\t\tformat: options.format,\n\t});\n};\n\nexport const projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tinstallDependencies({ installDependencies: _installDependencies }),\n\t\t\tconfigurePrismicModule(context),\n\t\t\tcreateSliceSimulatorPage(context),\n\t\t\tmodifySliceMachineConfig(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies","_a"],"mappings":";;;;;;;;;AAAA,IAAA;AAkBA,MAAM,eAAe;AAMrB,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,CAAC,YAAY,GAAG;AAAA,IAChB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,yBAAyB,OAAO,EACrC,SACA,cACgC;AAChC,MAAI,qBAAqB;AAErB,MAAA,CAAE,MAAM,oBAAoB,EAAE,UAAU,oBAAoB,QAAA,CAAS,GAAI;AACvD,yBAAA;AAIpB,QAAA,CAAE,MAAM,oBAAoB,EAAE,UAAU,oBAAoB,QAAA,CAAS,GACpE;AACD;AAAA,IACD;AAAA,EACD;AAEM,QAAA,iBAAiB,QAAQ,iBAAiB,kBAAkB;AAE5D,QAAA,MAAM,MAAM,SAAS,cAAc;AAEzC,QAAM,WACL,QAAQ,OAAO,eACf,WAAW,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"file":"project-init.js","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tcheckHasProjectFile,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport { builders, loadFile, writeFile } from \"magicast\";\n\nimport { buildSrcPath } from \"../lib/buildSrcPath\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst NUXT_PRISMIC = \"@nuxtjs/prismic\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t[NUXT_PRISMIC]: \"^1.4.2\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype ConfigurePrismicModuleArgs = SliceMachineContext<PluginOptions>;\n\nconst configurePrismicModule = async ({\n\thelpers,\n\tproject,\n}: ConfigurePrismicModuleArgs) => {\n\tlet nuxtConfigFilename = \"nuxt.config.js\";\n\n\tif (!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))) {\n\t\tnuxtConfigFilename = \"nuxt.config.ts\";\n\n\t\t// nuxt.config.* not found\n\t\tif (\n\t\t\t!(await checkHasProjectFile({ filename: nuxtConfigFilename, helpers }))\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst nuxtConfigPath = helpers.joinPathFromRoot(nuxtConfigFilename);\n\n\tconst mod = await loadFile(nuxtConfigPath);\n\n\tconst endpoint =\n\t\tproject.config.apiEndpoint ||\n\t\t`https://${project.config.repositoryName}.cdn.prismic.io/api/v2`;\n\n\tlet config;\n\ttry {\n\t\tconfig =\n\t\t\tmod.exports.default.$type === \"function-call\"\n\t\t\t\t? mod.exports.default.$args[0]\n\t\t\t\t: mod.exports.default;\n\t} catch {\n\t\tconst errorMessage = `Failed to update ${path.basename(nuxtConfigPath)}`;\n\t\tconsole.error(errorMessage);\n\t\tconsole.warn(\n\t\t\t`Ensure that the following has been added to ${path.basename(\n\t\t\t\tnuxtConfigPath,\n\t\t\t)}.`,\n\t\t);\n\t\tconsole.warn(stripIndent`\n\t\t\t{\n\t\t\t\tbuildModules: [\"@nuxtjs/prismic\"],\n\t\t\t\tprismic: {\n\t\t\t\t\tendpoint: \"${endpoint}\",\n\t\t\t\t\tmodern: true\n\t\t\t\t}\n\t\t\t}\n\t\t`);\n\n\t\tthrow errorMessage;\n\t}\n\n\t// Register Prismic module\n\tlet hasInlinedConfiguration = false;\n\tconst hasPrismicModuleRegistered = !![\n\t\t...(config.modules || []),\n\t\t...(config.buildModules || []),\n\t].find((registration: string | [string, unknown]) => {\n\t\tif (typeof registration === \"string\") {\n\t\t\treturn registration === NUXT_PRISMIC;\n\t\t} else if (Array.isArray(registration)) {\n\t\t\thasInlinedConfiguration = !!registration[1];\n\n\t\t\treturn registration[0] === NUXT_PRISMIC;\n\t\t}\n\n\t\treturn false;\n\t});\n\n\tif (!hasPrismicModuleRegistered) {\n\t\tconfig.buildModules ||= [];\n\t\tconfig.buildModules.push(NUXT_PRISMIC);\n\t}\n\n\t// Append Prismic module configuration\n\tif (!hasInlinedConfiguration) {\n\t\t// Import Slice Machine configuration\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"apiEndpoint\",\n\t\t});\n\t\tmod.imports.$add({\n\t\t\tfrom: \"./slicemachine.config.json\",\n\t\t\timported: \"repositoryName\",\n\t\t});\n\n\t\t// Add inline configuration\n\t\tif (config.prismic) {\n\t\t\tconfig.prismic.endpoint = builders.raw(\"apiEndpoint || repositoryName\");\n\t\t} else {\n\t\t\tconfig.prismic = {\n\t\t\t\tendpoint: builders.raw(\"apiEndpoint || repositoryName\"),\n\t\t\t\tmodern: true,\n\t\t\t};\n\t\t}\n\t}\n\n\tawait writeFile(mod, nuxtConfigPath);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst filename = await buildSrcPath({\n\t\tfilename: path.join(\"pages\", \"slice-simulator.vue\"),\n\t\thelpers,\n\t});\n\n\tif (await checkHasProjectFile({ filename, helpers })) {\n\t\treturn;\n\t}\n\n\tconst contents = stripIndent`\n\t\t<template>\n\t\t\t<SliceSimulator v-slot=\"{ slices }\">\n\t\t\t\t<SliceZone :slices=\"slices\" :components=\"components\" />\n\t\t\t</SliceSimulator>\n\t\t</template>\n\n\t\t<script>\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-nuxt2/dist/simulator.cjs\";\n\t\timport { components } from \"~/slices\";\n\n\t\texport default {\n\t\t\tcomponents: {\n\t\t\t\tSliceSimulator,\n\t\t\t},\n\t\t\tdata () {\n\t\t\t\treturn { components };\n\t\t\t},\n\t\t};\n\t\t</script>\n\t`;\n\n\tawait writeProjectFile({\n\t\tfilename,\n\t\tcontents,\n\t\tformat: options.format,\n\t\thelpers,\n\t});\n};\n\nconst modifySliceMachineConfig = async ({\n\thelpers,\n\toptions,\n\tactions,\n}: SliceMachineContext<PluginOptions>) => {\n\tconst hasSrcDirectory = await checkHasProjectFile({\n\t\tfilename: \"src\",\n\t\thelpers,\n\t});\n\tconst project = await helpers.getProject();\n\n\t// Add Slice Simulator URL.\n\tproject.config.localSliceSimulatorURL ||=\n\t\t\"http://localhost:3000/slice-simulator\";\n\n\t// Nest the default Slice Library in the src directory if it exists and\n\t// is empty.\n\tif (\n\t\thasSrcDirectory &&\n\t\tproject.config.libraries &&\n\t\tJSON.stringify(project.config.libraries) === JSON.stringify([\"./slices\"])\n\t) {\n\t\tconst sliceLibrary = await actions.readSliceLibrary({\n\t\t\tlibraryID: project.config.libraries[0],\n\t\t});\n\n\t\tif (sliceLibrary.sliceIDs.length < 1) {\n\t\t\tproject.config.libraries = [\"./src/slices\"];\n\t\t}\n\t}\n\n\tawait helpers.updateSliceMachineConfig(project.config, {\n\t\tformat: options.format,\n\t});\n};\n\nexport const projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tinstallDependencies({ installDependencies: _installDependencies }),\n\t\t\tconfigurePrismicModule(context),\n\t\t\tcreateSliceSimulatorPage(context),\n\t\t\tmodifySliceMachineConfig(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies","_a"],"mappings":";;;;;;;;;AAAA,IAAA;AAkBA,MAAM,eAAe;AAMrB,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,CAAC,YAAY,GAAG;AAAA,IAChB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,yBAAyB,OAAO,EACrC,SACA,cACgC;AAChC,MAAI,qBAAqB;AAErB,MAAA,CAAE,MAAM,oBAAoB,EAAE,UAAU,oBAAoB,QAAA,CAAS,GAAI;AACvD,yBAAA;AAIpB,QAAA,CAAE,MAAM,oBAAoB,EAAE,UAAU,oBAAoB,QAAA,CAAS,GACpE;AACD;AAAA,IACD;AAAA,EACD;AAEM,QAAA,iBAAiB,QAAQ,iBAAiB,kBAAkB;AAE5D,QAAA,MAAM,MAAM,SAAS,cAAc;AAEzC,QAAM,WACL,QAA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AO;AAAA,IAChC,yBAAyB,OAAO;AAAA,EAChC,CAAA,CAAC;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-read.cjs","sources":["../../../src/hooks/snippet-read.ts"],"sourcesContent":["import type {\n\tSliceMachineHelpers,\n\tSnippetReadHook,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst dotPath = (segments: string[]): string => {\n\treturn segments.join(\".\");\n};\n\nconst format = async (input: string, helpers: SliceMachineHelpers) => {\n\tconst formattedInput = await helpers.format(input, undefined, {\n\t\tincludeNewlineAtEnd: false,\n\t\tprettier: {\n\t\t\tparser: \"vue\",\n\t\t},\n\t});\n\n\treturn formattedInput.endsWith(\";\")\n\t\t? formattedInput.substring(0, formattedInput.length - 1)\n\t\t: formattedInput;\n};\n\nexport const snippetRead: SnippetReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst { fieldPath, itemName } = data;\n\n\tconst label = \"Vue\";\n\n\tswitch (data.model.type) {\n\t\tcase \"StructuredText\": {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (rich)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicRichText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (plain)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tconst repeat = data.model.config?.repeat ?? false;\n\t\t\tconst allowText = data.model.config?.allowText ?? false;\n\n\t\t\tconst allowVariants = Boolean(data.model.config?.variants);\n\t\t\tconst variant = (path: string) =>\n\t\t\t\tallowVariants ? ` :class=\"${path}.variant\"` : \"\";\n\n\t\t\tconst path = dotPath(fieldPath);\n\n\t\t\tlet codeText;\n\t\t\tif (!repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)}>Link</PrismicLink>\n\t\t\t\t`;\n\t\t\t} else if (!repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)} />\n\t\t\t\t`;\n\t\t\t} else if (repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")}>Link</PrismicLink>\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else if (repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")} />\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Invalid configuration.\");\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(codeText, helpers),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Image\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicImage :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Table\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicTable :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Embed\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicEmbed :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Group\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<template v-for=\"${itemName} in ${dotPath(fieldPath)}\">\n\t\t\t\t\t\t\t{{ ${itemName} }}\n\t\t\t\t\t\t</template>\n\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Slices\": {\n\t\t\tconst code = await format(\n\t\t\t\tstripIndent`\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\t:slices=\"${dotPath(fieldPath)}\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t`,\n\t\t\t\thelpers,\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t{{${dotPath(fieldPath)}}}\n\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n};\n"],"names":["stripIndent","path"],"mappings":";;;AAQA,MAAM,UAAU,CAAC,aAA8B;AACvC,SAAA,SAAS,KAAK,GAAG;AACzB;AAEA,MAAM,SAAS,OAAO,OAAe,YAAgC;AACpE,QAAM,iBAAiB,MAAM,QAAQ,OAAO,OAAO,QAAW;AAAA,IAC7D,qBAAqB;AAAA,IACrB,UAAU;AAAA,MACT,QAAQ;AAAA,IACR;AAAA,EAAA,CACD;AAEM,SAAA,eAAe,SAAS,GAAG,IAC/B,eAAe,UAAU,GAAG,eAAe,SAAS,CAAC,IACrD;AACJ;AAEO,MAAM,cAA8C,OAC1D,MACA,EAAE,cACC;;AACG,QAAA,EAAE,WAAW,SAAa,IAAA;AAEhC,QAAM,QAAQ;AAEN,UAAA,KAAK,MAAM,MAAM;AAAA,IACxB,KAAK,kBAAkB;AACf,aAAA;AAAA,QACN;AAAA,UACC,OAAO,GAAG;AAAA,
|
|
1
|
+
{"version":3,"file":"snippet-read.cjs","sources":["../../../src/hooks/snippet-read.ts"],"sourcesContent":["import type {\n\tSliceMachineHelpers,\n\tSnippetReadHook,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst dotPath = (segments: string[]): string => {\n\treturn segments.join(\".\");\n};\n\nconst format = async (input: string, helpers: SliceMachineHelpers) => {\n\tconst formattedInput = await helpers.format(input, undefined, {\n\t\tincludeNewlineAtEnd: false,\n\t\tprettier: {\n\t\t\tparser: \"vue\",\n\t\t},\n\t});\n\n\treturn formattedInput.endsWith(\";\")\n\t\t? formattedInput.substring(0, formattedInput.length - 1)\n\t\t: formattedInput;\n};\n\nexport const snippetRead: SnippetReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst { fieldPath, itemName } = data;\n\n\tconst label = \"Vue\";\n\n\tswitch (data.model.type) {\n\t\tcase \"StructuredText\": {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (rich)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicRichText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (plain)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tconst repeat = data.model.config?.repeat ?? false;\n\t\t\tconst allowText = data.model.config?.allowText ?? false;\n\n\t\t\tconst allowVariants = Boolean(data.model.config?.variants);\n\t\t\tconst variant = (path: string) =>\n\t\t\t\tallowVariants ? ` :class=\"${path}.variant\"` : \"\";\n\n\t\t\tconst path = dotPath(fieldPath);\n\n\t\t\tlet codeText;\n\t\t\tif (!repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)}>Link</PrismicLink>\n\t\t\t\t`;\n\t\t\t} else if (!repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)} />\n\t\t\t\t`;\n\t\t\t} else if (repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")}>Link</PrismicLink>\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else if (repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")} />\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Invalid configuration.\");\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(codeText, helpers),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Image\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicImage :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Table\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicTable :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Embed\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicEmbed :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Group\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<template v-for=\"${itemName} in ${dotPath(fieldPath)}\">\n\t\t\t\t\t\t\t{{ ${itemName} }}\n\t\t\t\t\t\t</template>\n\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Slices\": {\n\t\t\tconst code = await format(\n\t\t\t\tstripIndent`\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\t:slices=\"${dotPath(fieldPath)}\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t`,\n\t\t\t\thelpers,\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t{{${dotPath(fieldPath)}}}\n\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n};\n"],"names":["stripIndent","path"],"mappings":";;;AAQA,MAAM,UAAU,CAAC,aAA8B;AACvC,SAAA,SAAS,KAAK,GAAG;AACzB;AAEA,MAAM,SAAS,OAAO,OAAe,YAAgC;AACpE,QAAM,iBAAiB,MAAM,QAAQ,OAAO,OAAO,QAAW;AAAA,IAC7D,qBAAqB;AAAA,IACrB,UAAU;AAAA,MACT,QAAQ;AAAA,IACR;AAAA,EAAA,CACD;AAEM,SAAA,eAAe,SAAS,GAAG,IAC/B,eAAe,UAAU,GAAG,eAAe,SAAS,CAAC,IACrD;AACJ;AAEO,MAAM,cAA8C,OAC1D,MACA,EAAE,cACC;;AACG,QAAA,EAAE,WAAW,SAAa,IAAA;AAEhC,QAAM,QAAQ;AAEN,UAAA,KAAK,MAAM,MAAM;AAAA,IACxB,KAAK,kBAAkB;AACf,aAAA;AAAA,QACN;AAAA,UACC,OAAO,GAAG,KAAK;AAAA,UACf,UAAU;AAAA,UACV,MAAM,MAAM,OACXA;iCAC2B,QAAQ,SA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S,CAAC;AAAA,SAE5C,OAAO;AAAA,MAAA;AAAA,IAGV;AAAA,IAEA,KAAK,SAAS;AACN,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV,MAAM,MAAM,OACXA;+BAC0B,QAAQ,SAAS,CAAC;AAAA,SAE5C,OAAO;AAAA,MAAA;AAAA,IAGV;AAAA,IAEA,KAAK,SAAS;AACN,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV,MAAM,MAAM,OACXA;+BAC0B,QAAQ,SAAS,CAAC;AAAA,SAE5C,OAAO;AAAA,MAAA;AAAA,IAGV;AAAA,IAEA,KAAK,SAAS;AACN,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV,MAAM,MAAM,OACXA;yBACoB,QAAQ,OAAO,QAAQ,SAAS,CAAC;AAAA,YAC9C,QAAQ;AAAA;AAAA,QAGf,OAAO;AAAA,MAAA;AAAA,IAGV;AAAA,IAEA,KAAK,UAAU;AACR,YAAA,OAAO,MAAM,OAClBA;;iBAEa,QAAQ,SAAS,CAAC;AAAA;AAAA;AAAA,OAI/B,OAAO;AAGD,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV;AAAA,MAAA;AAAA,IAEF;AAAA,IAEA,SAAS;AACD,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV,MAAM,MAAM,OACXA;UACK,QAAQ,SAAS,CAAC;AAAA,QAEvB,OAAO;AAAA,MAAA;AAAA,IAGV;AAAA,EACD;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-read.js","sources":["../../../src/hooks/snippet-read.ts"],"sourcesContent":["import type {\n\tSliceMachineHelpers,\n\tSnippetReadHook,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst dotPath = (segments: string[]): string => {\n\treturn segments.join(\".\");\n};\n\nconst format = async (input: string, helpers: SliceMachineHelpers) => {\n\tconst formattedInput = await helpers.format(input, undefined, {\n\t\tincludeNewlineAtEnd: false,\n\t\tprettier: {\n\t\t\tparser: \"vue\",\n\t\t},\n\t});\n\n\treturn formattedInput.endsWith(\";\")\n\t\t? formattedInput.substring(0, formattedInput.length - 1)\n\t\t: formattedInput;\n};\n\nexport const snippetRead: SnippetReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst { fieldPath, itemName } = data;\n\n\tconst label = \"Vue\";\n\n\tswitch (data.model.type) {\n\t\tcase \"StructuredText\": {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (rich)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicRichText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (plain)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tconst repeat = data.model.config?.repeat ?? false;\n\t\t\tconst allowText = data.model.config?.allowText ?? false;\n\n\t\t\tconst allowVariants = Boolean(data.model.config?.variants);\n\t\t\tconst variant = (path: string) =>\n\t\t\t\tallowVariants ? ` :class=\"${path}.variant\"` : \"\";\n\n\t\t\tconst path = dotPath(fieldPath);\n\n\t\t\tlet codeText;\n\t\t\tif (!repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)}>Link</PrismicLink>\n\t\t\t\t`;\n\t\t\t} else if (!repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)} />\n\t\t\t\t`;\n\t\t\t} else if (repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")}>Link</PrismicLink>\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else if (repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")} />\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Invalid configuration.\");\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(codeText, helpers),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Image\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicImage :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Table\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicTable :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Embed\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicEmbed :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Group\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<template v-for=\"${itemName} in ${dotPath(fieldPath)}\">\n\t\t\t\t\t\t\t{{ ${itemName} }}\n\t\t\t\t\t\t</template>\n\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Slices\": {\n\t\t\tconst code = await format(\n\t\t\t\tstripIndent`\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\t:slices=\"${dotPath(fieldPath)}\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t`,\n\t\t\t\thelpers,\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t{{${dotPath(fieldPath)}}}\n\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n};\n"],"names":["path"],"mappings":";AAQA,MAAM,UAAU,CAAC,aAA8B;AACvC,SAAA,SAAS,KAAK,GAAG;AACzB;AAEA,MAAM,SAAS,OAAO,OAAe,YAAgC;AACpE,QAAM,iBAAiB,MAAM,QAAQ,OAAO,OAAO,QAAW;AAAA,IAC7D,qBAAqB;AAAA,IACrB,UAAU;AAAA,MACT,QAAQ;AAAA,IACR;AAAA,EAAA,CACD;AAEM,SAAA,eAAe,SAAS,GAAG,IAC/B,eAAe,UAAU,GAAG,eAAe,SAAS,CAAC,IACrD;AACJ;AAEO,MAAM,cAA8C,OAC1D,MACA,EAAE,cACC;;AACG,QAAA,EAAE,WAAW,SAAa,IAAA;AAEhC,QAAM,QAAQ;AAEN,UAAA,KAAK,MAAM,MAAM;AAAA,IACxB,KAAK,kBAAkB;AACf,aAAA;AAAA,QACN;AAAA,UACC,OAAO,GAAG;AAAA,
|
|
1
|
+
{"version":3,"file":"snippet-read.js","sources":["../../../src/hooks/snippet-read.ts"],"sourcesContent":["import type {\n\tSliceMachineHelpers,\n\tSnippetReadHook,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst dotPath = (segments: string[]): string => {\n\treturn segments.join(\".\");\n};\n\nconst format = async (input: string, helpers: SliceMachineHelpers) => {\n\tconst formattedInput = await helpers.format(input, undefined, {\n\t\tincludeNewlineAtEnd: false,\n\t\tprettier: {\n\t\t\tparser: \"vue\",\n\t\t},\n\t});\n\n\treturn formattedInput.endsWith(\";\")\n\t\t? formattedInput.substring(0, formattedInput.length - 1)\n\t\t: formattedInput;\n};\n\nexport const snippetRead: SnippetReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst { fieldPath, itemName } = data;\n\n\tconst label = \"Vue\";\n\n\tswitch (data.model.type) {\n\t\tcase \"StructuredText\": {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (rich)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicRichText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (plain)`,\n\t\t\t\t\tlanguage: \"vue\",\n\t\t\t\t\tcode: await format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicText :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t`,\n\t\t\t\t\t\thelpers,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tconst repeat = data.model.config?.repeat ?? false;\n\t\t\tconst allowText = data.model.config?.allowText ?? false;\n\n\t\t\tconst allowVariants = Boolean(data.model.config?.variants);\n\t\t\tconst variant = (path: string) =>\n\t\t\t\tallowVariants ? ` :class=\"${path}.variant\"` : \"\";\n\n\t\t\tconst path = dotPath(fieldPath);\n\n\t\t\tlet codeText;\n\t\t\tif (!repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)}>Link</PrismicLink>\n\t\t\t\t`;\n\t\t\t} else if (!repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<PrismicLink :field=\"${path}\"${variant(path)} />\n\t\t\t\t`;\n\t\t\t} else if (repeat && !allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")}>Link</PrismicLink>\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else if (repeat && allowText) {\n\t\t\t\tcodeText = stripIndent`\n\t\t\t\t\t<template v-for=\"link in ${path}\" :key=\"link.key\">\n\t\t\t\t\t\t<PrismicLink :field=\"link\"${variant(\"link\")} />\n\t\t\t\t\t</template>\n\t\t\t\t`;\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Invalid configuration.\");\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(codeText, helpers),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Image\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicImage :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Table\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicTable :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Embed\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicEmbed :field=\"${dotPath(fieldPath)}\" />\n\t\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Group\": {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode: await format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<template v-for=\"${itemName} in ${dotPath(fieldPath)}\">\n\t\t\t\t\t\t\t{{ ${itemName} }}\n\t\t\t\t\t\t</template>\n\t\t\t\t\t`,\n\t\t\t\t\thelpers,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase \"Slices\": {\n\t\t\tconst code = await format(\n\t\t\t\tstripIndent`\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\t:slices=\"${dotPath(fieldPath)}\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t`,\n\t\t\t\thelpers,\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"vue\",\n\t\t\t\tcode,\n\t\t\t};\n\t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S;AACN,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV,MAAM,MAAM,OACX;AAAA,yBACoB,QAAQ,OAAO,QAAQ,SAAS,CAAC;AAAA,YAC9C,QAAQ;AAAA;AAAA,QAGf,OAAO;AAAA,MAAA;AAAA,IAGV;AAAA,IAEA,KAAK,UAAU;AACR,YAAA,OAAO,MAAM,OAClB;AAAA;AAAA,iBAEa,QAAQ,SAAS,CAAC;AAAA;AAAA;AAAA,OAI/B,OAAO;AAGD,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV;AAAA,MAAA;AAAA,IAEF;AAAA,IAEA,SAAS;AACD,aAAA;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV,MAAM,MAAM,OACX;AAAA,UACK,QAAQ,SAAS,CAAC;AAAA,QAEvB,OAAO;AAAA,MAAA;AAAA,IAGV;AAAA,EACD;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsertSliceLibraryIndexFile.cjs","sources":["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport {\n\tbuildSliceDirectoryPath,\n\tbuildSliceLibraryDirectoryPath,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport * as path from \"node:path\";\n\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\nimport { PluginOptions } from \"../types\";\n\nimport { getJSFileExtension } from \"./getJSFileExtension\";\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents: string;\n\n\tif (args.options.lazyLoadSlices) {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\texport const components = {\n\t\t\t\t${(\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\treturn `${id}: () => import(/* webpackChunkName: \"prismic__${args.libraryID.replace(\n\t\t\t\t\t\t\t\t/[^\\w]/g,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t)}__${id}\" */ \"./${dirName}/index.vue\")`;\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t).join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\t${(\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `import ${componentName} from \"./${dirName}/index.vue\";`;\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t).join(\"\\n\")}\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: ${componentName}`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t}\n\n\tconst extension = await getJSFileExtension({\n\t\thelpers: args.helpers,\n\t\toptions: args.options,\n\t});\n\tconst filePath = path.join(\n\t\tbuildSliceLibraryDirectoryPath({\n\t\t\tlibraryID: args.libraryID,\n\t\t\thelpers: args.helpers,\n\t\t}),\n\t\t`index.${extension}`,\n\t);\n\n\tawait writeProjectFile({\n\t\tfilename: filePath,\n\t\tcontents,\n\t\tformat: args.options.format,\n\t\thelpers: args.helpers,\n\t});\n};\n"],"names":["stripIndent","NON_EDITABLE_FILE_BANNER","path","buildSliceDirectoryPath","pascalCase","getJSFileExtension","buildSliceLibraryDirectoryPath","writeProjectFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBa,MAAA,8BAA8B,OAC1C,SACkB;AAClB,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;AAEG,MAAA;AAEA,MAAA,KAAK,QAAQ,gBAAgB;AACrB,eAAAA,WAAAA;AAAAA,KACRC
|
|
1
|
+
{"version":3,"file":"upsertSliceLibraryIndexFile.cjs","sources":["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport {\n\tbuildSliceDirectoryPath,\n\tbuildSliceLibraryDirectoryPath,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport * as path from \"node:path\";\n\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\nimport { PluginOptions } from \"../types\";\n\nimport { getJSFileExtension } from \"./getJSFileExtension\";\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents: string;\n\n\tif (args.options.lazyLoadSlices) {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\texport const components = {\n\t\t\t\t${(\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\treturn `${id}: () => import(/* webpackChunkName: \"prismic__${args.libraryID.replace(\n\t\t\t\t\t\t\t\t/[^\\w]/g,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t)}__${id}\" */ \"./${dirName}/index.vue\")`;\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t).join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\t${(\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `import ${componentName} from \"./${dirName}/index.vue\";`;\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t).join(\"\\n\")}\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: ${componentName}`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t}\n\n\tconst extension = await getJSFileExtension({\n\t\thelpers: args.helpers,\n\t\toptions: args.options,\n\t});\n\tconst filePath = path.join(\n\t\tbuildSliceLibraryDirectoryPath({\n\t\t\tlibraryID: args.libraryID,\n\t\t\thelpers: args.helpers,\n\t\t}),\n\t\t`index.${extension}`,\n\t);\n\n\tawait writeProjectFile({\n\t\tfilename: filePath,\n\t\tcontents,\n\t\tformat: args.options.format,\n\t\thelpers: args.helpers,\n\t});\n};\n"],"names":["stripIndent","NON_EDITABLE_FILE_BANNER","path","buildSliceDirectoryPath","pascalCase","getJSFileExtension","buildSliceLibraryDirectoryPath","writeProjectFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBa,MAAA,8BAA8B,OAC1C,SACkB;AAClB,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;AAEG,MAAA;AAEA,MAAA,KAAK,QAAQ,gBAAgB;AACrB,eAAAA,WAAAA;AAAAA,KACRC,kCAAwB;AAAA;AAAA;AAAA,OAIxB,MAAM,QAAQ,IACb,OAAO,IAAI,OAAO,UAAS;AACpB,YAAA,KAAK,MAAM,MAAM;AACvB,YAAM,UAAUC,gBAAK,SACpB,MAAMC,GAAAA,wBAAwB;AAAA,QAC7B,OAAO,MAAM;AAAA,QACb,SAAS,KAAK;AAAA,QACd,WAAW,KAAK;AAAA,MAChB,CAAA,C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["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport {\n\tbuildSliceDirectoryPath,\n\tbuildSliceLibraryDirectoryPath,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport * as path from \"node:path\";\n\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\nimport { PluginOptions } from \"../types\";\n\nimport { getJSFileExtension } from \"./getJSFileExtension\";\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents: string;\n\n\tif (args.options.lazyLoadSlices) {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\texport const components = {\n\t\t\t\t${(\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\treturn `${id}: () => import(/* webpackChunkName: \"prismic__${args.libraryID.replace(\n\t\t\t\t\t\t\t\t/[^\\w]/g,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t)}__${id}\" */ \"./${dirName}/index.vue\")`;\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t).join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\t${(\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `import ${componentName} from \"./${dirName}/index.vue\";`;\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t).join(\"\\n\")}\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: ${componentName}`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t}\n\n\tconst extension = await getJSFileExtension({\n\t\thelpers: args.helpers,\n\t\toptions: args.options,\n\t});\n\tconst filePath = path.join(\n\t\tbuildSliceLibraryDirectoryPath({\n\t\t\tlibraryID: args.libraryID,\n\t\t\thelpers: args.helpers,\n\t\t}),\n\t\t`index.${extension}`,\n\t);\n\n\tawait writeProjectFile({\n\t\tfilename: filePath,\n\t\tcontents,\n\t\tformat: args.options.format,\n\t\thelpers: args.helpers,\n\t});\n};\n"],"names":[],"mappings":";;;;;;AAmBa,MAAA,8BAA8B,OAC1C,SACkB;AAClB,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;AAEG,MAAA;AAEA,MAAA,KAAK,QAAQ,gBAAgB;AACrB,eAAA;AAAA,KACR;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"upsertSliceLibraryIndexFile.js","sources":["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport {\n\tbuildSliceDirectoryPath,\n\tbuildSliceLibraryDirectoryPath,\n\twriteProjectFile,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\nimport * as path from \"node:path\";\n\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\nimport { PluginOptions } from \"../types\";\n\nimport { getJSFileExtension } from \"./getJSFileExtension\";\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents: string;\n\n\tif (args.options.lazyLoadSlices) {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\texport const components = {\n\t\t\t\t${(\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\treturn `${id}: () => import(/* webpackChunkName: \"prismic__${args.libraryID.replace(\n\t\t\t\t\t\t\t\t/[^\\w]/g,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t)}__${id}\" */ \"./${dirName}/index.vue\")`;\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t).join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\t${(\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\tconst dirName = path.basename(\n\t\t\t\t\t\t\tawait buildSliceDirectoryPath({\n\t\t\t\t\t\t\t\tmodel: slice.model,\n\t\t\t\t\t\t\t\thelpers: args.helpers,\n\t\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `import ${componentName} from \"./${dirName}/index.vue\";`;\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t).join(\"\\n\")}\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: ${componentName}`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\",\\n\")}\n\t\t\t};\n\t\t`;\n\t}\n\n\tconst extension = await getJSFileExtension({\n\t\thelpers: args.helpers,\n\t\toptions: args.options,\n\t});\n\tconst filePath = path.join(\n\t\tbuildSliceLibraryDirectoryPath({\n\t\t\tlibraryID: args.libraryID,\n\t\t\thelpers: args.helpers,\n\t\t}),\n\t\t`index.${extension}`,\n\t);\n\n\tawait writeProjectFile({\n\t\tfilename: filePath,\n\t\tcontents,\n\t\tformat: args.options.format,\n\t\thelpers: args.helpers,\n\t});\n};\n"],"names":[],"mappings":";;;;;;AAmBa,MAAA,8BAA8B,OAC1C,SACkB;AAClB,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA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ACrB,+BAA+B;AAAA,IAC9B,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,EACd,CAAA,GACD,SAAS,SAAS,EAAE;AAGrB,QAAM,iBAAiB;AAAA,IACtB,UAAU;AAAA,IACV;AAAA,IACA,QAAQ,KAAK,QAAQ;AAAA,IACrB,SAAS,KAAK;AAAA,EAAA,CACd;AACF;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/adapter-nuxt2",
|
|
3
|
-
"version": "0.3.78
|
|
3
|
+
"version": "0.3.78",
|
|
4
4
|
"description": "Slice Machine adapter for Nuxt 2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@prismicio/simulator": "^0.1.4",
|
|
63
63
|
"@prismicio/types-internal": "3.10.0",
|
|
64
|
-
"@slicemachine/plugin-kit": "0.4.77
|
|
64
|
+
"@slicemachine/plugin-kit": "0.4.77",
|
|
65
65
|
"common-tags": "^1.8.2",
|
|
66
66
|
"fp-ts": "^2.13.1",
|
|
67
67
|
"io-ts": "^2.2.20",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"size-limit": "8.2.4",
|
|
90
90
|
"ts-morph": "17.0.1",
|
|
91
91
|
"typescript": "4.9.5",
|
|
92
|
-
"vite": "4.
|
|
92
|
+
"vite": "4.5.14",
|
|
93
93
|
"vite-plugin-sdk": "0.1.1",
|
|
94
94
|
"vitest": "0.32.0",
|
|
95
95
|
"vue": "2.7.14"
|
|
@@ -102,6 +102,5 @@
|
|
|
102
102
|
},
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public"
|
|
105
|
-
}
|
|
106
|
-
"stableVersion": "0.3.77"
|
|
105
|
+
}
|
|
107
106
|
}
|