Skip to content

Commit

Permalink
create meteor-runtime package
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-muir committed Aug 1, 2023
1 parent dadee6c commit d224e25
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 83 deletions.
26 changes: 26 additions & 0 deletions _prototype/meteor-runtime/meteor-runtime-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export { Accounts } from './src/browser/accounts-base/client_main.js';
import './src/browser/accounts-password/password_client.js';
import './src/browser/accounts-oauth/oauth_client.js';
export { check, Match } from './src/browser/check/match.js';
export { DDP } from './src/browser/ddp-client/client/client.js';
export { DiffSequence } from './src/browser/diff-sequence/diff.js';
export { EJSON } from './src/browser/ejson/ejson.js';
export { Google } from './src/browser/google-oauth/google_client.js';
export { HTTP } from './src/browser/deprecated/http/httpcall_client.js';
export { Meteor } from './src/browser/meteor-star-client.js';
export {
LocalCollection,
Minimongo,
} from './src/browser/minimongo/minimongo_client.js';
export { Mongo } from './src/browser/mongo/client_main.js';
export { MongoID } from './src/browser/mongo-id/id.js';
export { OAuth } from './src/browser/oauth/oauth_client.js';
// export { Promise } from './src/browser/promise/client.js';
export { Random } from './src/browser/random/main_client.js';
export { ReactiveDict } from './src/browser/reactive-dict/reactive-dict.js';
export { ReactiveVar } from './src/browser/reactive-var/reactive-var.js';
export { Reload } from './src/browser/reload/reload.js';
export { Retry } from './src/browser/retry/retry.js';
export { Session } from './src/browser/session/session.js';
export { Tracker } from './src/browser/tracker/tracker.js';
export { default as _ } from 'underscore';
27 changes: 27 additions & 0 deletions _prototype/meteor-runtime/meteor-runtime-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export { Accounts } from './src/node/accounts-base/server_main.js';
import './src/node/accounts-password/password_server.js';
import './src/node/accounts-oauth/oauth_server.js';
export { check, Match } from './src/node/check/match.js';
export { DDPRateLimiter } from './src/node/ddp-rate-limiter/ddp-rate-limiter.js';
export { DDPServer } from './src/node/ddp-server/server_convenience.js';
export { DiffSequence } from './src/node/diff-sequence/diff.js';
export { EJSON } from './src/node/ejson/ejson.js';
export { Email } from './src/node/email/email.js';
export { Google } from './src/node/google-oauth/google_server.js';
export { HTTP } from './src/node/deprecated/http/httpcall_server.js';
export { Meteor } from './src/node/meteor-star-server.js';
export {
LocalCollection,
Minimongo,
} from './src/node/minimongo/minimongo_server.js';
export { Mongo } from './src/node/mongo/server_main.js';
export { MongoID } from './src/node/mongo-id/id.js';
export { OAuth } from './src/node/oauth/oauth_server.js';
import './src/node/oauth2/oauth2_server.js';
export { Promise } from './src/node/promise/server.js';
export { Random } from './src/node/random/main_server.js';
export { RateLimiter } from './src/node/rate-limit/rate-limit.js';
export { RoutePolicy } from './src/node/routepolicy/main.js';
export { ServiceConfiguration } from './src/node/service-configuration/service_configuration_server.js';
export * as WebApp from './src/node/webapp/webapp_server.js';
export { default as _ } from 'underscore';
29 changes: 29 additions & 0 deletions _prototype/meteor-runtime/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"private": true,
"name": "@meteor/runtime",
"type": "module",
"exports": {
"browser": "./dist/meteor-runtime-browser.js",
"node": "./dist/meteor-runtime-node.js"
},
"peerDependencies": {
"bcrypt": "^5.0.1",
"body-parser": "^1.19.0",
"chalk": "^4.1.1",
"compression": "^1.7.4",
"connect": "^3.7.0",
"cookie-parser": "^1.4.5",
"decimal.js": "^10.3.1",
"denque": "^2.1.0",
"fibers": "^5.0.1",
"meteor-promise": "^0.9.0",
"mongodb": "^4.16.0",
"node-fetch": "^2.3.0",
"nodemailer": "^6.6.3",
"parseurl": "^1.3.3",
"permessage-deflate": "^0.1.7",
"qs": "^6.10.1",
"sockjs": "^0.3.24",
"underscore": "^1.13.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import alias from '@rollup/plugin-alias';
import replace from '@rollup/plugin-replace';
import inject from '@rollup/plugin-inject';
import path from 'node:path';

export default [
{
input: './meteor-runtime-browser.mjs',
input: './meteor-runtime-browser.js',
output: {
file: './meteor-runtime-browser.esm.js',
file: './dist/meteor-runtime-browser.js',
format: 'es',
},
external: ['decimal.js', 'sockjs-client'],
},
{
input: './meteor-runtime-server.mjs',
}, {
input: './meteor-runtime-node.js',
output: {
file: './meteor-runtime-server.esm.js',
file: './dist/meteor-runtime-node.js',
format: 'es',
},
external: [
Expand All @@ -38,8 +32,6 @@ export default [
'fs', // node:fs
'http', // node:http
'meteor-promise',
'meteor/inter-process-messaging',
'meteor/reload', // elided
'mongodb',
'mongodb-uri',
'node-fetch',
Expand All @@ -55,5 +47,7 @@ export default [
'url', // node:url
'useragent',
],
},
];
}
]


24 changes: 0 additions & 24 deletions meteor-runtime-browser.mjs

This file was deleted.

29 changes: 0 additions & 29 deletions meteor-runtime-server.mjs

This file was deleted.

6 changes: 2 additions & 4 deletions packages/oauth/oauth_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,9 @@ OAuth._renderOauthResults = (res, query, credentialSecret) => {
// This "template" (not a real Spacebars template, just an HTML file
// with some ##PLACEHOLDER##s) communicates the credential secret back
// to the main window and then closes the popup.
OAuth._endOfPopupResponseTemplate = Assets.getText(
"end_of_popup_response.html");
OAuth._endOfPopupResponseTemplate = '';

OAuth._endOfRedirectResponseTemplate = Assets.getText(
"end_of_redirect_response.html");
OAuth._endOfRedirectResponseTemplate = '';

// Renders the end of login response template into some HTML and JavaScript
// that closes the popup or redirects at the end of the OAuth flow.
Expand Down
11 changes: 2 additions & 9 deletions packages/socket-stream-client/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,8 @@ export class ClientStream extends StreamClientCommon {
...this.options._sockjsOptions
};

const hasSockJS = typeof SockJS === "function";
const disableSockJS = __meteor_runtime_config__.DISABLE_SOCKJS;

this.socket = hasSockJS && !disableSockJS
// Convert raw URL to SockJS URL each time we open a connection, so
// that we can connect to random hostnames and get around browser
// per-host connection limits.
? new SockJS(toSockjsUrl(this.rawUrl), undefined, options)
: new WebSocket(toWebsocketUrl(this.rawUrl));

this.socket = new WebSocket(toWebsocketUrl(this.rawUrl));

this.socket.onopen = data => {
this.lastError = null;
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -871,14 +871,14 @@ export default [
makeConfig(
clientInputFiles,
{
dir: 'modules-client',
dir: '_prototype/meteor-runtime/src/browser',
},
true
),
makeConfig(
serverInputFiles,
{
dir: 'modules-server',
dir: '_prototype/meteor-runtime/src/node',
},
false
),
Expand Down

0 comments on commit d224e25

Please sign in to comment.