@meteor-vite/plugin-zodern-relay 1.0.0
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/Plugin.d.mts +5 -0
- package/dist/Plugin.d.ts +5 -0
- package/dist/Plugin.js +45 -0
- package/dist/Plugin.js.map +1 -0
- package/dist/Plugin.mjs +24 -0
- package/dist/Plugin.mjs.map +1 -0
- package/package.json +47 -0
- package/src/Plugin.ts +24 -0
- package/stubs/relay-client.js +23 -0
package/dist/Plugin.d.ts
ADDED
package/dist/Plugin.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/Plugin.ts
|
|
21
|
+
var Plugin_exports = {};
|
|
22
|
+
__export(Plugin_exports, {
|
|
23
|
+
default: () => zodernRelay
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Plugin_exports);
|
|
26
|
+
var sourceModule = "meteor/zodern:relay";
|
|
27
|
+
var stubModule = "@meteor-vite/zodern-relay/stubs/relay-client";
|
|
28
|
+
async function zodernRelay() {
|
|
29
|
+
return {
|
|
30
|
+
name: "zodern-relay",
|
|
31
|
+
resolveId(id) {
|
|
32
|
+
if (!id.startsWith(sourceModule)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
return `\0${id}`;
|
|
36
|
+
},
|
|
37
|
+
load(id) {
|
|
38
|
+
if (!id.startsWith(`\0${sourceModule}`)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return `export * from ${JSON.stringify(stubModule)}`;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=Plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nconst sourceModule = 'meteor/zodern:relay';\nconst stubModule = '@meteor-vite/zodern-relay/stubs/relay-client';\n\nexport default async function zodernRelay(): Promise<Plugin> {\n return {\n name: 'zodern-relay',\n resolveId(id) {\n if (!id.startsWith(sourceModule)) {\n return;\n }\n return `\\0${id}`;\n },\n load(id) {\n if (!id.startsWith(`\\0${sourceModule}`)) {\n return;\n }\n \n // language=typescript\n return `export * from ${JSON.stringify(stubModule)}`;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAM,eAAe;AACrB,IAAM,aAAa;AAEnB,eAAO,cAAsD;AACzD,SAAO;AAAA,IACH,MAAM;AAAA,IACN,UAAU,IAAI;AACV,UAAI,CAAC,GAAG,WAAW,YAAY,GAAG;AAC9B;AAAA,MACJ;AACA,aAAO,KAAK,EAAE;AAAA,IAClB;AAAA,IACA,KAAK,IAAI;AACL,UAAI,CAAC,GAAG,WAAW,KAAK,YAAY,EAAE,GAAG;AACrC;AAAA,MACJ;AAGA,aAAO,iBAAiB,KAAK,UAAU,UAAU,CAAC;AAAA,IACtD;AAAA,EACJ;AACJ;","names":[]}
|
package/dist/Plugin.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/Plugin.ts
|
|
2
|
+
var sourceModule = "meteor/zodern:relay";
|
|
3
|
+
var stubModule = "@meteor-vite/zodern-relay/stubs/relay-client";
|
|
4
|
+
async function zodernRelay() {
|
|
5
|
+
return {
|
|
6
|
+
name: "zodern-relay",
|
|
7
|
+
resolveId(id) {
|
|
8
|
+
if (!id.startsWith(sourceModule)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
return `\0${id}`;
|
|
12
|
+
},
|
|
13
|
+
load(id) {
|
|
14
|
+
if (!id.startsWith(`\0${sourceModule}`)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
return `export * from ${JSON.stringify(stubModule)}`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
zodernRelay as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nconst sourceModule = 'meteor/zodern:relay';\nconst stubModule = '@meteor-vite/zodern-relay/stubs/relay-client';\n\nexport default async function zodernRelay(): Promise<Plugin> {\n return {\n name: 'zodern-relay',\n resolveId(id) {\n if (!id.startsWith(sourceModule)) {\n return;\n }\n return `\\0${id}`;\n },\n load(id) {\n if (!id.startsWith(`\\0${sourceModule}`)) {\n return;\n }\n \n // language=typescript\n return `export * from ${JSON.stringify(stubModule)}`;\n }\n }\n}\n"],"mappings":";AAEA,IAAM,eAAe;AACrB,IAAM,aAAa;AAEnB,eAAO,cAAsD;AACzD,SAAO;AAAA,IACH,MAAM;AAAA,IACN,UAAU,IAAI;AACV,UAAI,CAAC,GAAG,WAAW,YAAY,GAAG;AAC9B;AAAA,MACJ;AACA,aAAO,KAAK,EAAE;AAAA,IAClB;AAAA,IACA,KAAK,IAAI;AACL,UAAI,CAAC,GAAG,WAAW,KAAK,YAAY,EAAE,GAAG;AACrC;AAAA,MACJ;AAGA,aAAO,iBAAiB,KAAK,UAAU,UAAU,CAAC;AAAA,IACtD;AAAA,EACJ;AACJ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@meteor-vite/plugin-zodern-relay",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Vite compatability plugin for zodern:relay - typed Meteor methods and publications",
|
|
5
|
+
"main": "dist/Plugin.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./dist/Plugin.js",
|
|
9
|
+
"import": "./dist/Plugin.mjs",
|
|
10
|
+
"types": "./dist/Plugin.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./stubs/*": [
|
|
13
|
+
"./stubs/*.js"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src",
|
|
19
|
+
"stubs"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"lint": "tsc --noEmit",
|
|
23
|
+
"test": "npm run lint",
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"prepack": "npm run build"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"meteor-vite",
|
|
29
|
+
"meteor",
|
|
30
|
+
"zodern:relay",
|
|
31
|
+
"vite",
|
|
32
|
+
"typescript"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"author": "Jørgen Vatle <jorgen@wcaservices.net>",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"url": "https://github.com/JorgenVatle/meteor-vite"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"tsup": "^8.0.2",
|
|
44
|
+
"typescript": "^5.4.2",
|
|
45
|
+
"vite": "^5.1.6"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/Plugin.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
const sourceModule = 'meteor/zodern:relay';
|
|
4
|
+
const stubModule = '@meteor-vite/zodern-relay/stubs/relay-client';
|
|
5
|
+
|
|
6
|
+
export default async function zodernRelay(): Promise<Plugin> {
|
|
7
|
+
return {
|
|
8
|
+
name: 'zodern-relay',
|
|
9
|
+
resolveId(id) {
|
|
10
|
+
if (!id.startsWith(sourceModule)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return `\0${id}`;
|
|
14
|
+
},
|
|
15
|
+
load(id) {
|
|
16
|
+
if (!id.startsWith(`\0${sourceModule}`)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// language=typescript
|
|
21
|
+
return `export * from ${JSON.stringify(stubModule)}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub module for zodern:relay
|
|
3
|
+
* Used as a replacement for imports for createMethod() or createPublication() from `meteor/zodern:relay`.
|
|
4
|
+
*/
|
|
5
|
+
let relayClient;
|
|
6
|
+
const require = Package.modules.meteorInstall({
|
|
7
|
+
'__stub__zodern-relay_client.js': (require, exports, module) => {
|
|
8
|
+
relayClient = require('meteor/zodern:relay/client.ts')
|
|
9
|
+
}
|
|
10
|
+
}, {
|
|
11
|
+
"extensions": [
|
|
12
|
+
".js"
|
|
13
|
+
]
|
|
14
|
+
});
|
|
15
|
+
require('/__stub__zodern-relay_client.js');
|
|
16
|
+
|
|
17
|
+
export function createMethod(method) {
|
|
18
|
+
return relayClient._createClientMethod(method.name);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createPublication(publication) {
|
|
22
|
+
return relayClient._createClientPublication(publication.name);
|
|
23
|
+
}
|