Merge branch 'release-3.0' into release-3.0-tools-and-mongo

# Conflicts:
#	meteor
#	npm-packages/eslint-plugin-meteor/scripts/dev-bundle-tool-package.js
#	npm-packages/meteor-babel/package-lock.json
#	npm-packages/meteor-babel/package.json
#	packages/babel-compiler/.npm/package/npm-shrinkwrap.json
#	packages/babel-compiler/package.js
#	packages/meteor/package.js
#	scripts/dev-bundle-tool-package.js
This commit is contained in:
denihs
2023-01-18 15:37:36 -04:00
71 changed files with 747 additions and 5348 deletions

19
.github/workflows/check-code-style.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Check code-style
on:
push:
paths:
- 'npm-packages/meteor-installer/**'
pull_request:
paths:
- 'npm-packages/meteor-installer/**'
jobs:
check-code-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
- run: npm ci
- name: Run ESLint@8
run: npx eslint@8 "./npm-packages/meteor-installer/**/*.js"

View File

@@ -1,6 +1,7 @@
title: Meteor API Docs
subtitle: API Docs
versions:
- '2.10'
- '2.9'
- '2.8'
- '2.7'

View File

@@ -33,32 +33,32 @@
* `accounts-password`:
- Some server methods are now async:
- `Accounts.sendResetPasswordEmail`
- `Accounts.sendEnrollmentEmail`
- `Accounts.sendVerificationEmail`
- `Accounts.addEmail`
- `Accounts.removeEmail`
- `Accounts.verifyEmail`
- `Accounts.createUserVerifyingEmail`
- `Accounts.createUser`
- `Accounts.generateVerificationToken`
- `Accounts.generateResetToken`
- `Accounts.forgotPassword`
- `Accounts.setPassword`
- `Accounts.changePassword`
- `Accounts.setUsername`
- `Accounts.findUserByEmail`
- `Accounts.findUserByUsername`
- `Accounts.sendResetPasswordEmail`
- `Accounts.sendEnrollmentEmail`
- `Accounts.sendVerificationEmail`
- `Accounts.addEmail`
- `Accounts.removeEmail`
- `Accounts.verifyEmail`
- `Accounts.createUserVerifyingEmail`
- `Accounts.createUser`
- `Accounts.generateVerificationToken`
- `Accounts.generateResetToken`
- `Accounts.forgotPassword`
- `Accounts.setPassword`
- `Accounts.changePassword`
- `Accounts.setUsername`
- `Accounts.findUserByEmail`
- `Accounts.findUserByUsername`
* `accounts-passwordless`:
- `Accounts.sendLoginTokenEmail` is now async
* `boilerplate-generator`:
- `toHTML` is no longer available (it was already deprecated). Use `toHTMLStream` instead.
* `oauth`:
- `_endOfPopupResponseTemplate` and `_endOfRedirectResponseTemplate` are no longer a property but now a function that returns a promise of the same value as before
- the following server methods are now async:
- the following server methods are now async:
- `OAuth._renderOauthResults`
- `OAuth._endOfLoginResponse`
- `OAuth.renderEndOfLoginResponse`
@@ -80,7 +80,7 @@
* `webapp`:
- `WebAppInternals.getBoilerplate` is now async.
#### Internal API changes
@@ -94,6 +94,143 @@ You can follow in [here](https://guide.meteor.com/3.0-migration.html).
For making this great framework even better!
## v2.10.0, 2023-01-13
### Highlights
* Update skeletons to use React 18 [PR](https://github.com/meteor/meteor/pull/12419) by [StorytellerCZ](https://github.com/StorytellerCZ).
* Use MongoDB types instead of the homebuilt [PR](https://github.com/meteor/meteor/pull/12415) by [perbergland](https://github.com/perbergland).
* Fixing wrong type definitions in MongoDB package [PR](https://github.com/meteor/meteor/pull/12409) by [ebroder](https://github.com/ebroder).
* Typescript to version v4.7.4 [PR](https://github.com/meteor/meteor/pull/12393) by [StorytellerCZ](https://github.com/StorytellerCZ).
* Update test-in-browser dependencies [PR](https://github.com/meteor/meteor/pull/12384) by [harryadel](https://github.com/harryadel).
* Update boilerplate-generator-tests [PR](https://github.com/meteor/meteor/pull/12429) by [harryadel](https://github.com/harryadel).
* Replace double-ended-queue with denque [PR](https://github.com/meteor/meteor/pull/12430) by [harryadel](https://github.com/harryadel).
* Allow multiple runtime config and updated runtime hooks [PR](https://github.com/meteor/meteor/pull/12426) by [ebroder](https://github.com/ebroder).
* Added async forEach and clear for method Hooks [PR](https://github.com/meteor/meteor/pull/12427) by [Grubba27](https://github.com/Grubba27).
* Implemented async Tracker with explicit values [PR](https://github.com/meteor/meteor/pull/12294) by [radekmie](https://github.com/radekmie).
* Improved eslint config [PR](https://github.com/meteor/meteor/pull/12309) by [afrokick](https://github.com/afrokick).
#### Breaking Changes
N/A
#### Internal API changes
N/A
#### Migration Steps
N/A
#### Meteor Version Release
* `babel-compiler@7.10.2`:
- Updated @meteorjs/babel to version 7.18.0.
- Updated to typescript to version v4.7.4.
* `boilerplate-generator-tests@1.5.1`:
- Updated parse5 and turned streamToString into a local function.
* `callback-hook@1.5.0`
- Added forEachAsync.
* `ecmascript@0.16.5`
- Updated typescript to version 4.7.4.
* `Command line`:
- Updated React skeletons to use React 18
* `Meteor@1.11.0`:
- Replaced double-ended-queue with [denque](https://github.com/invertase/denque)
* `mongo@1.16.4`:
- Fixed wrong type definitions.
- switch to using MongoDB types instead of the homebuilt.
- Fixed wrong type definitions in MongoDB package related to dropIndexAsync
* `react-fast-refresh@0.2.5`:
- Updated react-refresh dependency.
* `test-in-browser@1.3.3`:
- Updated dependencies and removed unused libs.
* `Tracker@1.3.0`:
- Implemented async Tracker with explicit values
* `typescript@4.7.4`
- Updated typescript to version 4.7.4.
* `webapp@1.13.3`
- The forEach method on Hook will stop iterating unless the iterator function returns a truthy value.
Previously, this meant that only the first registered runtime config hook would be called.
* `@meteorjs/babel@7.18.0-beta.5`
- Updated typescript to version 4.7.4.
#### Special thanks to
- [@StorytellerCZ](https://github.com/StorytellerCZ).
- [@perbergland](https://github.com/perbergland).
- [@ebroder](https://github.com/ebroder).
- [@harryadel](https://github.com/harryadel).
- [@radekmie](https://github.com/radekmie).
- [@Grubba27](https://github.com/Grubba27).
- [@afrokick](https://github.com/afrokick).
For making this great framework even better!
## v2.9.1, 2022-12-27
### Highlights
* Reverted missing types [PR](https://github.com/meteor/meteor/pull/12366) by [Grubba27](https://github.com/Grubba27).
* Fix fetch() type declaration [PR](https://github.com/meteor/meteor/pull/12352) by [zarvox](https://github.com/zarvox).
* update svelte skeleton [PR](https://github.com/meteor/meteor/pull/12350) by [tosinek](https://github.com/tosinek).
* Bump to node 14.21.2.0 [PR](https://github.com/meteor/meteor/pull/12370) by [Grubba27](https://github.com/Grubba27).
* resetPassword and verifyEmail to no longer sign in the user automatically [PR](https://github.com/meteor/meteor/pull/12385) by [denihs](https://github.com/denihs).
* Added missing vue2 declaration for skeletons [PR](https://github.com/meteor/meteor/pull/12396) by [Grubba27](https://github.com/Grubba27) & [mlanning](https://github.com/mlanning).
#### Breaking Changes
* `accounts-password@2.3.3`
- The methods `resetPassword` and `verifyEmail` no longer logs the user if they have 2FA enabled. Now, the functions work as before, but instead of automatically logging in the user at the end, an error with the code `2fa-enabled` will be thrown.
#### Internal API changes
N/A
#### Migration Steps
N/A
#### Meteor Version Release
* `fetch@0.1.3`:
- Updated fetch type definition.
* `meteor@1.10.4`:
- Added back meteor type definitions that were removed by mistake in earlier version.
* `accounts-password@2.3.3`
- The methods `resetPassword` and `verifyEmail` no longer logs the user if they have 2FA enabled. Now, the functions work as before, but instead of automatically logging in the user at the end, an error with the code `2fa-enabled` will be thrown.
* `Command line`:
- Updated Svelte skeleton to now be able to support typescript out of the box and added ``#each`` in links in the skeleton.
- Updated node to 14.21.2 changes can be seen [here](https://github.com/nodejs/node/releases/tag/v14.21.2).
- Solved [issue](https://github.com/meteor/meteor/issues/12395) that could not allow vue2 apps being created in command line.
#### Special thanks to
- [@zarvox](https://github.com/zarvox).
- [@tosinek](https://github.com/tosinek).
- [@Grubba27](https://github.com/Grubba27).
- [@denihs](https://github.com/denihs).
- [@mlanning](https://github.com/mlanning).
For making this great framework even better!
## v2.9, 2022-12-12
### Highlights

View File

@@ -59,6 +59,10 @@ email with a link the user can use to verify their email address.
{% apibox "Accounts.verifyEmail" %}
If the user trying to verify the email has 2FA enabled, this error will be thrown:
* "Email verified, but user not logged in because 2FA is enabled [2fa-enabled]": No longer signing in the user automatically if the user has 2FA enabled.
This function accepts tokens passed into the callback registered with
[`Accounts.onEmailVerificationLink`](#Accounts-onEmailVerificationLink).
@@ -89,6 +93,9 @@ This function accepts tokens passed into the callbacks registered with
[`AccountsClient#onResetPasswordLink`](#Accounts-onResetPasswordLink) and
[`Accounts.onEnrollmentLink`](#Accounts-onEnrollmentLink).
If the user trying to reset the password has 2FA enabled, this error will be thrown:
* "Changed password, but user not logged in because 2FA is enabled [2fa-enabled]": No longer signing in the user automatically if the user has 2FA enabled.
{% apibox "Accounts.setPassword" %}
{% apibox "Accounts.sendResetPasswordEmail" %}

View File

@@ -80,7 +80,22 @@ If the initial run of an autorun throws an exception, the computation
is automatically stopped and won't be rerun.
### Tracker.autorun and async callbacks
`Tracker.autorun` can accept an `async` callback function. However, the async call back function will only be dependent on reactive functions called prior to any called functions that return a promise.
`Tracker.autorun` can accept an `async` callback function.
However, to make the async call reactive, you should wrap your async function in
a `Tracker.withComputation` call.
```javascript
Tracker.autorun(async function example1(computation) {
let asyncData =
await Tracker.withComputation(computation, () => asyncDataFunction());
let users = Meteor.users.find({}).fetch();
});
```
> If you want to get computation in other way you can use `Tracker.currentComputation`
#### Using async callbacks in versions of Meteor prior to 2.10
`Tracker.autorun` can accept an `async` callback function.
However, the async call back function will only be dependent on reactive functions called prior to any called functions that return a promise.
Example 1 - autorun `example1()` **is not** dependent on reactive changes to the `Meteor.users` collection. Because it is dependent on nothing reactive it will run only once:
```javascript
@@ -99,7 +114,6 @@ Example 2 - autorun `example2()` **is** dependent on reactive changes to the Me
let asyncData = await asyncDataFunction();
});
```
{% apibox "Tracker.flush" %}
Normally, when you make changes (like writing to the database),

View File

@@ -174,38 +174,38 @@ Create a basic [Solid](https://www.solidjs.com/) app.
| | Default (`--react`) | `--bare` | `--full` | `--minimal` | `--blaze` | `--apollo` | `--vue-2` | `--svelte` | `--tailwind` | `--chakra-ui` | `--solid` | `--vue` |
|------------------------------------------------------------------------------------------------------|:-------------------:|:--------:|:--------:|:-----------:|:---------:|:----------:|:---------:|:----------:|:------------:|:-------------:|:---------:|:-------:|
| [autopublish](https://atmospherejs.com/meteor/autopublish) | X | | | | X | | | X | X | X | X | |
| [autopublish](https://atmospherejs.com/meteor/autopublish) | X | | | | X | | | | X | X | X | |
| [akryum:vue-component](https://atmospherejs.com/akryum/vue-component) | | | | | | | X | | | | | |
| [apollo](https://atmospherejs.com/meteor/apollo) | | | | | | X | | | | | | |
| [blaze-html-templates](https://atmospherejs.com/meteor/blaze-html-templates) | | | X | | X | | | | | | | |
| [ecmascript](https://atmospherejs.com/meteor/ecmascript) | X | X | X | X | X | X | X | X | X | X | X | X |
| [es5-shim](https://atmospherejs.com/meteor/es5-shim) | X | X | X | X | X | X | X | X | X | X | X | X |
| [hot-module-replacement](https://atmospherejs.com/meteor/hot-module-replacement) | X | | | | X | X | | | X | X | X | X |
| [insecure](https://atmospherejs.com/meteor/insecure) | X | | | | X | | | X | X | X | X | X |
| [hot-module-replacement](https://atmospherejs.com/meteor/hot-module-replacement) | X | | | | X | X | | X | X | X | X | X |
| [insecure](https://atmospherejs.com/meteor/insecure) | X | | | | X | | | | X | X | X | X |
| [johanbrook:publication-collector](https://atmospherejs.com/meteor/johanbrook/publication-collector) | | | X | | | X | | | | | | |
| [jquery](https://atmospherejs.com/meteor/jquery) | | | X | | X | | | | | | | |
| [ostrio:flow-router-extra](https://atmospherejs.com/meteor/ostrio/flow-router-extra) | | | X | | | | | | | | | |
| [less](https://atmospherejs.com/meteor/less) | | | X | | | | | | | | | |
| [meteor](https://atmospherejs.com/meteor/meteor) | | | | X | | | | | | | | |
| [meteor-base](https://atmospherejs.com/meteor/meteor-base) | X | X | X | | X | X | X | X | X | X | X | X |
| [mobile-experience](https://atmospherejs.com/meteor/mobile-experience) | X | X | X | | X | X | X | X | X | X | X | X |
| [mongo](https://atmospherejs.com/meteor/mongo) | X | X | X | | X | X | X | X | X | X | X | X |
| [meteortesting:mocha](https://atmospherejs.com/meteortesting/mocha) | | | X | | | | X | | | | | |
| [reactive-var](https://atmospherejs.com/meteor/reactive-var) | X | X | X | | X | X | X | X | X | X | X | X |
| [rdb:svelte-meteor-data](https://atmospherejs.com/rdb/svelte-meteor-data) | | | | | | | | X | | | | |
| [ostrio:flow-router-extra](https://atmospherejs.com/meteor/ostrio/flow-router-extra) | | | X | | | | | | | | | |
| [react-meteor-data](https://atmospherejs.com/meteor/react-meteor-data) | X | | | | | | | | X | X | | |
| [reactive-var](https://atmospherejs.com/meteor/reactive-var) | X | X | X | | X | X | X | | X | X | X | X |
| [server-render](https://atmospherejs.com/meteor/server-render) | | | | X | | X | X | | | | | |
| [shell-server](https://atmospherejs.com/meteor/shell-server) | | X | | X | X | X | X | X | X | X | X | X |
| [standard-minifier-css](https://atmospherejs.com/meteor/standard-minifier-css) | X | X | X | X | X | X | X | X | X | X | X | X |
| [standard-minifier-js](https://atmospherejs.com/meteor/standard-minifier-js) | X | X | X | X | X | X | X | X | X | X | X | X |
| [static-html](https://atmospherejs.com/meteor/static-html) | | X | | X | | X | X | X | | | | |
| [svelte:compiler](https://atmospherejs.com/svelte/compiler) | | | | | | | | X | | | | |
| [swydo:graphql](https://atmospherejs.com/swydo/graphql) | | | | | | X | | | | | | |
| [tailwindcss](https://tailwindcss.com) | | X | X | | X | | X | | X | | | |
| [tracker](https://atmospherejs.com/meteor/tracker) | | X | X | | X | | X | | | | | |
| [typescript](https://atmospherejs.com/meteor/typescript) | X | X | X | X | X | X | X | X | X | X | X | |
| [webapp](https://atmospherejs.com/meteor/webapp) | | | | X | | | | | | | | |
| [react-meteor-data](https://atmospherejs.com/meteor/react-meteor-data) | X | | | | | | | | X | X | | |
| [vite:bundler](https://atmospherejs.com/vite/bundler) | | | | | | | | | | | X | X |
| [webapp](https://atmospherejs.com/meteor/webapp) | | | | X | | | | | | | | |
| [zodern:melte](https://atmospherejs.com/zodern/melte) | | | | | | | | X | | | | |
| [zodern:types](https://atmospherejs.com/zodern/types) | | | | | | | | X | | | | |
<h2 id="meteorgenerate"> meteor generate </h2>
@@ -926,7 +926,7 @@ from npm to your `node_modules` directory and save its usage in your
Using the `meteor npm ...` commands in place of traditional `npm ...` commands
is particularly important when using Node.js modules that have binary
dependencies that make native C calls (like [`bcrypt`](https://www.npmjs.com/package/bcrypt))
because doing so ensures that they are built using the same libaries.
because doing so ensures that they are built using the same libraries.
Additionally, this access to the npm that comes with Meteor avoids the need to
download and install npm separately.

View File

@@ -5,6 +5,7 @@ edit_branch: 'devel'
edit_path: 'guide'
content_root: 'content'
versions:
- '2.10'
- '2.9'
- '2.8'
- '2.7'

View File

@@ -14,8 +14,8 @@ var packageJson = {
pacote: "https://github.com/meteor/pacote/tarball/a81b0324686e85d22c7688c47629d4009000e8b8",
"node-gyp": "8.0.0",
"node-pre-gyp": "0.15.0",
typescript: "4.6.4",
"@meteorjs/babel": "7.17.1-beta.0",
typescript: "4.7.4",
"@meteorjs/babel": "7.18.0-beta.5",
"@meteorjs/reify": "0.24.0",
// So that Babel can emit require("@babel/runtime/helpers/...") calls.
"@babel/runtime": "7.15.3",

View File

@@ -47,7 +47,7 @@
"convert-source-map": "^1.6.0",
"lodash": "^4.17.21",
"meteor-babel-helpers": "0.0.3",
"typescript": "~4.6.4"
"typescript": "~4.7.4"
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "7.14.5",

View File

@@ -14,6 +14,8 @@ npm install -g meteor
| NPM Package | Meteor Official Release |
|-------------|-------------------------|
| 2.9.1 | 2.9.1 |
| 2.9.0 | 2.9.0 |
| 2.8.2 | 2.8.1 |
| 2.8.1 | 2.8.1 |
| 2.8.0 | 2.8.0 |

View File

@@ -14,7 +14,7 @@ if (!command) {
}
if (command === 'install') {
require('./install.js');
require('./install');
} else if (command === 'uninstall') {
const { uninstall } = require('./uninstall');
uninstall();

View File

@@ -1,7 +1,7 @@
const path = require('path');
const os = require('os');
const METEOR_LATEST_VERSION = '2.9.0';
const METEOR_LATEST_VERSION = '2.10.0';
const sudoUser = process.env.SUDO_USER || '';
function isRoot() {
return process.getuid && process.getuid() === 0;
@@ -31,9 +31,8 @@ if (isWindows() && !localAppData) {
throw new Error('LOCALAPPDATA env var is not set.');
}
const shouldSetupExecPath = () => {
return !process.env.npm_config_ignore_meteor_setup_exec_path;
}
const shouldSetupExecPath = () =>
!process.env.npm_config_ignore_meteor_setup_exec_path;
const meteorLocalFolder = '.meteor';
const meteorPath = path.resolve(rootPath, meteorLocalFolder);

View File

@@ -4,7 +4,7 @@ const Seven = require('node-7z');
const fs = require('fs');
const { resolve, dirname } = require('path');
const child_process = require('child_process');
const { isMac } = require('./config.js')
const { isMac } = require('./config.js');
function extractWith7Zip(tarPath, destination, onProgress) {
return new Promise((resolve, reject) => {
@@ -29,7 +29,7 @@ function extractWith7Zip(tarPath, destination, onProgress) {
function createSymlinks(symlinks, baseDir) {
symlinks.forEach(({ path, linkPath }) => {
try {
let resolveBase = resolve(baseDir, dirname(path));
const resolveBase = resolve(baseDir, dirname(path));
const result = fs.statSync(resolve(resolveBase, linkPath));
if (result.isDirectory()) {
@@ -45,7 +45,7 @@ function createSymlinks(symlinks, baseDir) {
});
}
function extractWithNativeTar(tarPath, destination, onProgress) {
function extractWithNativeTar(tarPath, destination) {
child_process.execSync(
`tar -xf "${tarPath}" ${
!isMac() ? `--checkpoint-action=ttyout="#%u: %T \r"` : ``
@@ -60,7 +60,7 @@ function extractWithNativeTar(tarPath, destination, onProgress) {
}
function extractWithTar(tarPath, destination, onProgress) {
let symlinks = [];
const symlinks = [];
let total = 0;
// This takes a few seconds, but lets us show the progress

View File

@@ -3,11 +3,14 @@ const cliProgress = require('cli-progress');
const Seven = require('node-7z');
const path = require('path');
const sevenBin = require('7zip-bin');
const fs = require('fs');
const semver = require('semver');
const child_process = require('child_process');
const fsPromises = fs.promises;
const tmp = require('tmp');
const os = require('os');
const fs = require('fs');
const fsPromises = fs.promises;
const {
meteorPath,
release,
@@ -20,26 +23,30 @@ const {
isMac,
METEOR_LATEST_VERSION,
shouldSetupExecPath,
} = require('./config.js');
} = require('./config');
const { uninstall } = require('./uninstall');
const {
extractWithTar,
extractWith7Zip,
extractWithNativeTar,
} = require('./extract.js');
const semver = require('semver');
const isInstalledGlobally = process.env.npm_config_global === 'true';
} = require('./extract');
const { engines } = require('./package.json');
const { engines } = require('./package');
const nodeVersion = engines.node;
const npmVersion = engines.npm;
// Compare installed NodeJs version with required NodeJs version
if (!semver.satisfies(process.version, nodeVersion)) {
console.warn(`WARNING: Recommended versions are Node.js ${nodeVersion} and npm ${npmVersion}.`);
console.warn(`We recommend using a Node version manager like NVM or Volta to install Node.js and npm.\n`);
console.warn(
`WARNING: Recommended versions are Node.js ${nodeVersion} and npm ${npmVersion}.`
);
console.warn(
`We recommend using a Node version manager like NVM or Volta to install Node.js and npm.\n`
);
}
const isInstalledGlobally = process.env.npm_config_global === 'true';
if (!isInstalledGlobally) {
console.error('******************************************');
console.error(
@@ -54,7 +61,10 @@ process.on('unhandledRejection', err => {
throw err;
});
if (os.arch() !== 'x64') {
const isValidM1Version = semver.gte(semver.coerce(METEOR_LATEST_VERSION), '2.5.1-beta.3');
const isValidM1Version = semver.gte(
semver.coerce(METEOR_LATEST_VERSION),
'2.5.1-beta.3'
);
if (os.arch() !== 'arm64' || !isMac() || !isValidM1Version) {
console.error(
'The current architecture is not supported in this version: ',
@@ -170,8 +180,8 @@ function download() {
override: true,
fileName: tarGzName,
httpsRequestOptions: {
agent: generateProxyAgent()
}
agent: generateProxyAgent(),
},
});
dl.on('progress', ({ progress }) => {
@@ -250,7 +260,7 @@ async function extract() {
fileCount: 0,
});
let tarPath = path.resolve(tempPath, tarName);
const tarPath = path.resolve(tempPath, tarName);
// 7Zip is ~15% faster, but doesn't work when the user doesn't have permission to create symlinks
// TODO: we could always use 7zip if we have it ignore the symlinks, and then manually create them as
// is done in extractWithTar
@@ -279,15 +289,14 @@ async function setup() {
}
async function setupExecPath() {
if (isWindows()) {
//set for the current session and beyond
// set for the current session and beyond
child_process.execSync(`setx path "${meteorPath}/;%path%`);
return;
}
const exportCommand = `export PATH=${meteorPath}:$PATH`;
const appendPathToFile = async file => {
return fsPromises.appendFile(`${rootPath}/${file}`, `${exportCommand}\n`);
};
const appendPathToFile = async file =>
fsPromises.appendFile(`${rootPath}/${file}`, `${exportCommand}\n`);
if (process.env.SHELL && process.env.SHELL.includes('zsh')) {
await appendPathToFile('.zshrc');

View File

@@ -1,6 +1,6 @@
{
"name": "meteor",
"version": "2.9.0",
"version": "2.10.0",
"description": "Install Meteor",
"main": "install.js",
"scripts": {

View File

@@ -1,20 +1,20 @@
const { meteorPath } = require('./config.js');
const { meteorPath } = require('./config');
const rimraf = require('rimraf');
function uninstall() {
console.log(`Uninstalling Meteor from ${meteorPath}`);
try {
rimraf.sync(meteorPath)
rimraf.sync(meteorPath);
} catch (err) {
console.log('Encountered error while uninstalling:');
console.error(err);
process.exit(1);
}
console.log('Successfully uninstalled Meteor');
}
module.exports = {
uninstall
}
uninstall,
};

View File

@@ -19,6 +19,21 @@
"eslintConfig": {
"extends": [
"@quave/quave"
]
],
"rules": {
"global-require": "off",
"no-console": "off",
"camelcase": "warn",
"consistent-return": "off",
"quotes": "warn",
"no-shadow": [
"error",
{
"allow": ["resolve"]
}
],
"no-use-before-define": "warn",
"import/no-unresolved": "warn"
}
}
}

View File

@@ -5,7 +5,7 @@ Package.describe({
// 2.2.x in the future. The version was also bumped to 2.0.0 temporarily
// during the Meteor 1.5.1 release process, so versions 2.0.0-beta.2
// through -beta.5 and -rc.0 have already been published.
version: '2.3.2',
version: '2.3.3',
});
Npm.depends({

View File

@@ -201,7 +201,7 @@ Accounts.forgotPassword = (options, callback) => {
// @param callback (optional) {Function(error|undefined)}
/**
* @summary Reset the password for a user using a token received in email. Logs the user in afterwards.
* @summary Reset the password for a user using a token received in email. Logs the user in afterwards if the user doesn't have 2FA enabled.
* @locus Client
* @param {String} token The token retrieved from the reset password URL.
* @param {String} newPassword A new password for the user. This is __not__ sent in plain text over the wire.
@@ -234,7 +234,7 @@ Accounts.resetPassword = (token, newPassword, callback) => {
// @param callback (optional) {Function(error|undefined)}
/**
* @summary Marks the user's email address as verified. Logs the user in afterwards.
* @summary Marks the user's email address as verified. Logs the user in afterwards if the user doesn't have 2FA enabled.
* @locus Client
* @param {String} token The token retrieved from the verification URL.
* @param {Function} [callback] Optional callback. Called with no arguments on success, or with a single `Error` argument on failure.

View File

@@ -722,7 +722,16 @@ Meteor.methods(
// password should invalidate existing sessions).
await Accounts._clearAllLoginTokens(user._id);
return { userId: user._id };
if (Accounts._check2faEnabled?.(user)) {
return {
userId: user._id,
error: Accounts._handleError(
'Changed password, but user not logged in because 2FA is enabled',
false,
'2fa-enabled'
),
};
}return { userId: user._id };
}
);
}
@@ -825,7 +834,16 @@ Meteor.methods(
$pull: { 'services.email.verificationTokens': { address: tokenRecord.address } }
});
return { userId: user._id };
if (Accounts._check2faEnabled?.(user)) {
return {
userId: user._id,
error: Accounts._handleError(
'Email verified, but user not logged in because 2FA is enabled',
false,
'2fa-enabled'
),
};
}return { userId: user._id };
}
);
}

View File

@@ -1829,6 +1829,11 @@
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g=="
},
"yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
}
}
}

View File

@@ -1,11 +1,11 @@
Package.describe({
name: "babel-compiler",
summary: "Parser/transpiler for ECMAScript 2015+ syntax",
version: '7.10.1'
version: '7.10.2'
});
Npm.depends({
// '@meteorjs/babel': '7.17.2-beta.0',
// '@meteorjs/babel': '7.18.0-beta.5',
'@meteorjs/babel': 'file:///../../../../npm-packages/meteor-babel',
'json5': '2.1.1'
});

View File

@@ -2,19 +2,9 @@
"lockfileVersion": 1,
"dependencies": {
"parse5": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.2.tgz",
"integrity": "sha1-Be/1fw70V3+xRKefi5qWemzERRA="
},
"promise-polyfill": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-1.1.6.tgz",
"integrity": "sha1-zQTv9G9clcOn0EVZHXm14+AfEtc="
},
"stream-to-string": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stream-to-string/-/stream-to-string-1.1.0.tgz",
"integrity": "sha1-OSELATF+ars16FRTjgEwN7ajWUA="
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
}
}
}

View File

@@ -2,13 +2,12 @@ Package.describe({
// These tests are in a separate package so that we can Npm.depend on
// parse5, a html parsing library.
summary: "Tests for the boilerplate-generator package",
version: '1.5.0',
version: '1.5.1',
documentation: null
});
Npm.depends({
parse5: '3.0.2',
'stream-to-string': '1.1.0'
parse5: '6.0.1'
});
Package.onTest(function (api) {

View File

@@ -1,4 +1,11 @@
import streamToString from "stream-to-string";
function streamToString (stream) {
const chunks = [];
return new Promise((resolve, reject) => {
stream.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
stream.on('error', (err) => reject(err));
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
})
}
export async function generateHTMLForArch(arch, includeHead) {
// Use a dummy manifest. None of these paths will be read from the filesystem, but css / js should be handled differently

View File

@@ -135,6 +135,28 @@ export class Hook {
}
}
/**
* For each registered callback, call the passed iterator function with the callback.
*
* it is a counterpart of forEach, but it is async and returns a promise
* @param iterator
* @return {Promise<void>}
* @see forEach
*/
async forEachAsync(iterator) {
const ids = Object.keys(this.callbacks);
for (let i = 0; i < ids.length; ++i) {
const id = ids[i];
// check to see if the callback was removed during iteration
if (hasOwn.call(this.callbacks, id)) {
const callback = this.callbacks[id];
if (!await iterator(callback)) {
break;
}
}
}
}
/**
* @deprecated use forEach
* @param iterator

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Register callbacks on a hook",
version: '1.4.0'
version: '1.5.0'
});
Package.onUse(function (api) {

View File

@@ -1,6 +1,6 @@
Package.describe({
name: 'ecmascript',
version: '0.16.4',
version: '0.16.5',
summary: 'Compiler plugin that supports ES2015+ in all .js files',
documentation: 'README.md',
});

View File

@@ -1,4 +1,4 @@
export declare function fetch(): typeof globalThis.fetch;
export declare var fetch: typeof globalThis.fetch;
export declare var Headers: typeof globalThis.Headers;
export declare var Request: typeof globalThis.Request;
export declare var Response: typeof globalThis.Response;

View File

@@ -1,6 +1,6 @@
Package.describe({
name: "fetch",
version: '0.1.2',
version: '0.1.3',
summary: "Isomorphic modern/legacy/Node polyfill for WHATWG fetch()",
documentation: "README.md"
});

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'The Meteor command-line tool',
version: '2.9.0',
version: '2.10.0',
});
Package.includeTool();

View File

@@ -1,10 +1,10 @@
{
"lockfileVersion": 1,
"dependencies": {
"double-ended-queue": {
"version": "2.1.0-0",
"resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz",
"integrity": "sha1-ED01J/0xUo9AGIEwyEHv3XgmTlw="
"denque": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw=="
}
}
}

View File

@@ -2,7 +2,7 @@ Meteor._noYieldsAllowed = function (f) {
return f();
};
Meteor._DoubleEndedQueue = Npm.require('double-ended-queue');
Meteor._DoubleEndedQueue = Npm.require('denque');
// Meteor._SynchronousQueue is a queue which runs task functions serially.
// Tasks are assumed to be synchronous: ie, it's assumed that they are

View File

@@ -2,7 +2,7 @@
Package.describe({
summary: "Core Meteor environment",
version: '1.10.3'
version: '1.11.0'
});
Package.registerBuildPlugin({
@@ -11,7 +11,7 @@ Package.registerBuildPlugin({
});
Npm.depends({
"double-ended-queue": "2.1.0-0"
"denque": "2.1.0"
});
Package.onUse(function (api) {
@@ -63,6 +63,8 @@ Package.onUse(function (api) {
api.addFiles('emitter-promise.js', 'server');
api.export('EmitterPromise', 'server');
api.addAssets('meteor.d.ts', 'server');
});
Package.onTest(function (api) {

View File

@@ -15,80 +15,10 @@ export type UnionOmit<T, K extends keyof any> = T extends T
: never;
export namespace Mongo {
// prettier-ignore
type BsonType = 1 | "double" |
2 | "string" |
3 | "object" |
4 | "array" |
5 | "binData" |
6 | "undefined" |
7 | "objectId" |
8 | "bool" |
9 | "date" |
10 | "null" |
11 | "regex" |
12 | "dbPointer" |
13 | "javascript" |
14 | "symbol" |
15 | "javascriptWithScope" |
16 | "int" |
17 | "timestamp" |
18 | "long" |
19 | "decimal" |
-1 | "minKey" |
127 | "maxKey" | "number";
type FieldExpression<T> = {
$eq?: T | undefined;
$gt?: T | undefined;
$gte?: T | undefined;
$lt?: T | undefined;
$lte?: T | undefined;
$in?: T[] | undefined;
$nin?: T[] | undefined;
$ne?: T | undefined;
$exists?: boolean | undefined;
$type?: BsonType[] | BsonType | undefined;
$not?: FieldExpression<T> | undefined;
$expr?: FieldExpression<T> | undefined;
$jsonSchema?: any;
$mod?: number[] | undefined;
$regex?: RegExp | string | undefined;
$options?: string | undefined;
$text?:
| {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacriticSensitive?: boolean | undefined;
}
| undefined;
$where?: string | Function | undefined;
$geoIntersects?: any;
$geoWithin?: any;
$near?: any;
$nearSphere?: any;
$all?: T[] | undefined;
$elemMatch?: T extends {} ? Query<T> : FieldExpression<T> | undefined;
$size?: number | undefined;
$bitsAllClear?: any;
$bitsAllSet?: any;
$bitsAnyClear?: any;
$bitsAnySet?: any;
$comment?: string | undefined;
};
type Query<T> = MongoNpmModule.Filter<T>;
type Flatten<T> = T extends any[] ? T[0] : T;
type Query<T> = {
[P in keyof T]?: Flatten<T[P]> | RegExp | FieldExpression<Flatten<T[P]>>;
} & {
$or?: Query<T>[] | undefined;
$and?: Query<T>[] | undefined;
$nor?: Query<T>[] | undefined;
} & Dictionary<any>;
type QueryWithModifiers<T> = {
export type QueryWithModifiers<T> = {
$query: Query<T>;
$comment?: string | undefined;
$explain?: any;
@@ -103,67 +33,21 @@ export namespace Mongo {
$natural?: any;
};
type Selector<T> = Query<T> | QueryWithModifiers<T>;
export type Selector<T> = Query<T> | QueryWithModifiers<T>;
type Dictionary<T> = { [key: string]: T };
type PartialMapTo<T, M> = Partial<Record<keyof T, M>>;
type OnlyArrays<T> = T extends any[] ? T : never;
type OnlyElementsOfArrays<T> = T extends any[] ? Partial<T[0]> : never;
type ElementsOf<T> = {
[P in keyof T]?: OnlyElementsOfArrays<T[P]>;
};
type PushModifier<T> = {
[P in keyof T]?:
| OnlyElementsOfArrays<T[P]>
| {
$each?: T[P] | undefined;
$position?: number | undefined;
$slice?: number | undefined;
$sort?: 1 | -1 | Dictionary<number> | undefined;
};
};
type ArraysOrEach<T> = {
[P in keyof T]?: OnlyElementsOfArrays<T[P]> | { $each: T[P] };
};
type CurrentDateModifier = { $type: 'timestamp' | 'date' } | true;
type Modifier<T> =
| T
| {
$currentDate?:
| (Partial<Record<keyof T, CurrentDateModifier>> &
Dictionary<CurrentDateModifier>)
| undefined;
$inc?: (PartialMapTo<T, number> & Dictionary<number>) | undefined;
$min?:
| (PartialMapTo<T, Date | number> & Dictionary<Date | number>)
| undefined;
$max?:
| (PartialMapTo<T, Date | number> & Dictionary<Date | number>)
| undefined;
$mul?: (PartialMapTo<T, number> & Dictionary<number>) | undefined;
$rename?: (PartialMapTo<T, string> & Dictionary<string>) | undefined;
$set?: (Partial<T> & Dictionary<any>) | undefined;
$setOnInsert?: (Partial<T> & Dictionary<any>) | undefined;
$unset?:
| (PartialMapTo<T, string | boolean | 1 | 0> & Dictionary<any>)
| undefined;
$addToSet?: (ArraysOrEach<T> & Dictionary<any>) | undefined;
$push?: (PushModifier<T> & Dictionary<any>) | undefined;
$pull?: (ElementsOf<T> & Dictionary<any>) | undefined;
$pullAll?: (Partial<T> & Dictionary<any>) | undefined;
$pop?: (PartialMapTo<T, 1 | -1> & Dictionary<1 | -1>) | undefined;
};
type Modifier<T> = MongoNpmModule.UpdateFilter<T>;
type OptionalId<TSchema> = UnionOmit<TSchema, '_id'> & { _id?: any };
export type OptionalId<TSchema> = UnionOmit<TSchema, '_id'> & { _id?: any };
interface SortSpecifier {}
interface FieldSpecifier {
type SortSpecifier = MongoNpmModule.Sort;
export interface FieldSpecifier {
[id: string]: Number;
}
type Transform<T> = ((doc: T) => any) | null | undefined;
export type Transform<T> = ((doc: T) => any) | null | undefined;
type Options<T> = {
export type Options<T> = {
/** Sort order (default: natural order) */
sort?: SortSpecifier | undefined;
/** Number of results to skip at the beginning */
@@ -269,7 +153,7 @@ export namespace Mongo {
transform?: Fn | undefined;
}): boolean;
dropCollectionAsync(): Promise<void>;
dropIndexAsync(indexName: string): void;
dropIndexAsync(indexName: string): Promise<void>;
/**
* Find the documents in a collection that match the selector.
* @param selector A query describing the documents to find
@@ -541,8 +425,8 @@ export namespace Mongo {
callbacks: ObserveChangesCallbacks<T>,
options?: { nonMutatingCallbacks?: boolean | undefined }
): Meteor.LiveQueryHandle;
[Symbol.iterator](): Iterator<T, never, never>;
[Symbol.asyncIterator](): AsyncIterator<T, never, never>;
[Symbol.iterator](): Iterator<T>;
[Symbol.asyncIterator](): AsyncIterator<T>;
}
var ObjectID: ObjectIDStatic;

View File

@@ -9,7 +9,7 @@
Package.describe({
summary: "Adaptor for using MongoDB and Minimongo over DDP",
version: '1.16.3'
version: '1.16.4'
});
Npm.depends({

View File

@@ -1,14 +1,14 @@
Package.describe({
name: 'react-fast-refresh',
version: '0.2.3',
version: '0.2.5',
summary: 'Automatically update React components with HMR',
documentation: 'README.md',
devOnly: true,
});
Npm.depends({
'react-refresh': '0.11.0',
semver: '7.3.4',
'react-refresh': '0.14.0',
semver: '7.3.8',
});
Package.onUse(function(api) {

View File

@@ -1,8 +1,7 @@
/**
* Diff Match and Patch
*
* Copyright 2006 Google Inc.
* http://code.google.com/p/google-diff-match-patch/
* Copyright 2018 The diff-match-patch Authors.
* https://github.com/google/diff-match-patch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +26,7 @@
* Class containing the diff, match and patch methods.
* @constructor
*/
function diff_match_patch() {
var diff_match_patch = function() {
// Defaults.
// Redefine these in your program to override the defaults.
@@ -52,7 +51,7 @@ function diff_match_patch() {
// The number of bits in an int.
this.Match_MaxBits = 32;
}
};
// DIFF FUNCTIONS
@@ -67,9 +66,18 @@ var DIFF_DELETE = -1;
var DIFF_INSERT = 1;
var DIFF_EQUAL = 0;
/** @typedef {{0: number, 1: string}} */
diff_match_patch.Diff;
/**
* Class representing one diff tuple.
* ~Attempts to look like a two-element array (which is what this used to be).~
* Constructor returns an actual two-element array, to allow destructing @JackuB
* See https://github.com/JackuB/diff-match-patch/issues/14 for details
* @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL.
* @param {string} text Text to be deleted, inserted, or retained.
* @constructor
*/
diff_match_patch.Diff = function(op, text) {
return [op, text];
};
/**
* Find the differences between two texts. Simplifies the problem by stripping
@@ -79,7 +87,7 @@ diff_match_patch.Diff;
* @param {boolean=} opt_checklines Optional speedup flag. If present and false,
* then don't run a line-level diff first to identify the changed areas.
* Defaults to true, which does a faster, slightly less optimal diff.
* @param {number} opt_deadline Optional time when the diff should be complete
* @param {number=} opt_deadline Optional time when the diff should be complete
* by. Used internally for recursive calls. Users should set DiffTimeout
* instead.
* @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
@@ -104,7 +112,7 @@ diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
// Check for equality (speedup).
if (text1 == text2) {
if (text1) {
return [[DIFF_EQUAL, text1]];
return [new diff_match_patch.Diff(DIFF_EQUAL, text1)];
}
return [];
}
@@ -131,10 +139,10 @@ diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
// Restore the prefix and suffix.
if (commonprefix) {
diffs.unshift([DIFF_EQUAL, commonprefix]);
diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, commonprefix));
}
if (commonsuffix) {
diffs.push([DIFF_EQUAL, commonsuffix]);
diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, commonsuffix));
}
this.diff_cleanupMerge(diffs);
return diffs;
@@ -159,12 +167,12 @@ diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
if (!text1) {
// Just add some text (speedup).
return [[DIFF_INSERT, text2]];
return [new diff_match_patch.Diff(DIFF_INSERT, text2)];
}
if (!text2) {
// Just delete some text (speedup).
return [[DIFF_DELETE, text1]];
return [new diff_match_patch.Diff(DIFF_DELETE, text1)];
}
var longtext = text1.length > text2.length ? text1 : text2;
@@ -172,9 +180,10 @@ diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
var i = longtext.indexOf(shorttext);
if (i != -1) {
// Shorter text is inside the longer text (speedup).
diffs = [[DIFF_INSERT, longtext.substring(0, i)],
[DIFF_EQUAL, shorttext],
[DIFF_INSERT, longtext.substring(i + shorttext.length)]];
diffs = [new diff_match_patch.Diff(DIFF_INSERT, longtext.substring(0, i)),
new diff_match_patch.Diff(DIFF_EQUAL, shorttext),
new diff_match_patch.Diff(DIFF_INSERT,
longtext.substring(i + shorttext.length))];
// Swap insertions for deletions if diff is reversed.
if (text1.length > text2.length) {
diffs[0][0] = diffs[2][0] = DIFF_DELETE;
@@ -185,7 +194,8 @@ diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
if (shorttext.length == 1) {
// Single character string.
// After the previous speedup, the character can't be an equality.
return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
return [new diff_match_patch.Diff(DIFF_DELETE, text1),
new diff_match_patch.Diff(DIFF_INSERT, text2)];
}
// Check to see if the problem can be split in two.
@@ -201,7 +211,8 @@ diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);
var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);
// Merge the results.
return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
return diffs_a.concat([new diff_match_patch.Diff(DIFF_EQUAL, mid_common)],
diffs_b);
}
if (checklines && text1.length > 100 && text2.length > 100) {
@@ -238,7 +249,7 @@ diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
// Rediff any replacement blocks, this time character-by-character.
// Add a dummy entry at the end.
diffs.push([DIFF_EQUAL, '']);
diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ''));
var pointer = 0;
var count_delete = 0;
var count_insert = 0;
@@ -261,11 +272,12 @@ diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
diffs.splice(pointer - count_delete - count_insert,
count_delete + count_insert);
pointer = pointer - count_delete - count_insert;
var a = this.diff_main(text_delete, text_insert, false, deadline);
for (var j = a.length - 1; j >= 0; j--) {
diffs.splice(pointer, 0, a[j]);
var subDiff =
this.diff_main(text_delete, text_insert, false, deadline);
for (var j = subDiff.length - 1; j >= 0; j--) {
diffs.splice(pointer, 0, subDiff[j]);
}
pointer = pointer + a.length;
pointer = pointer + subDiff.length;
}
count_insert = 0;
count_delete = 0;
@@ -399,7 +411,8 @@ diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
}
// Diff took too long and hit the deadline or
// number of diffs equals number of characters, no commonality at all.
return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
return [new diff_match_patch.Diff(DIFF_DELETE, text1),
new diff_match_patch.Diff(DIFF_INSERT, text2)];
};
@@ -471,21 +484,29 @@ diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
lineEnd = text.length - 1;
}
var line = text.substring(lineStart, lineEnd + 1);
lineStart = lineEnd + 1;
if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :
(lineHash[line] !== undefined)) {
chars += String.fromCharCode(lineHash[line]);
} else {
if (lineArrayLength == maxLines) {
// Bail out at 65535 because
// String.fromCharCode(65536) == String.fromCharCode(0)
line = text.substring(lineStart);
lineEnd = text.length;
}
chars += String.fromCharCode(lineArrayLength);
lineHash[line] = lineArrayLength;
lineArray[lineArrayLength++] = line;
}
lineStart = lineEnd + 1;
}
return chars;
}
// Allocate 2/3rds of the space for text1, the rest for text2.
var maxLines = 40000;
var chars1 = diff_linesToCharsMunge_(text1);
maxLines = 65535;
var chars2 = diff_linesToCharsMunge_(text2);
return {chars1: chars1, chars2: chars2, lineArray: lineArray};
};
@@ -499,13 +520,13 @@ diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
* @private
*/
diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
for (var x = 0; x < diffs.length; x++) {
var chars = diffs[x][1];
for (var i = 0; i < diffs.length; i++) {
var chars = diffs[i][1];
var text = [];
for (var y = 0; y < chars.length; y++) {
text[y] = lineArray[chars.charCodeAt(y)];
for (var j = 0; j < chars.length; j++) {
text[j] = lineArray[chars.charCodeAt(j)];
}
diffs[x][1] = text.join('');
diffs[i][1] = text.join('');
}
};
@@ -523,7 +544,7 @@ diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
return 0;
}
// Binary search.
// Performance analysis: http://neil.fraser.name/news/2007/10/09/
// Performance analysis: https://neil.fraser.name/news/2007/10/09/
var pointermin = 0;
var pointermax = Math.min(text1.length, text2.length);
var pointermid = pointermax;
@@ -555,7 +576,7 @@ diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {
return 0;
}
// Binary search.
// Performance analysis: http://neil.fraser.name/news/2007/10/09/
// Performance analysis: https://neil.fraser.name/news/2007/10/09/
var pointermin = 0;
var pointermax = Math.min(text1.length, text2.length);
var pointermid = pointermax;
@@ -604,7 +625,7 @@ diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
// Start by looking for a single character match
// and increase length until no match is found.
// Performance analysis: http://neil.fraser.name/news/2010/11/04/
// Performance analysis: https://neil.fraser.name/news/2010/11/04/
var best = 0;
var length = 1;
while (true) {
@@ -731,7 +752,7 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
var equalities = []; // Stack of indices where equalities are found.
var equalitiesLength = 0; // Keeping our own length var is faster in JS.
/** @type {?string} */
var lastequality = null;
var lastEquality = null;
// Always equal to diffs[equalities[equalitiesLength - 1]][1]
var pointer = 0; // Index of current position.
// Number of characters that changed prior to the equality.
@@ -747,7 +768,7 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
length_deletions1 = length_deletions2;
length_insertions2 = 0;
length_deletions2 = 0;
lastequality = diffs[pointer][1];
lastEquality = diffs[pointer][1];
} else { // An insertion or deletion.
if (diffs[pointer][0] == DIFF_INSERT) {
length_insertions2 += diffs[pointer][1].length;
@@ -756,13 +777,13 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
}
// Eliminate an equality that is smaller or equal to the edits on both
// sides of it.
if (lastequality && (lastequality.length <=
if (lastEquality && (lastEquality.length <=
Math.max(length_insertions1, length_deletions1)) &&
(lastequality.length <= Math.max(length_insertions2,
(lastEquality.length <= Math.max(length_insertions2,
length_deletions2))) {
// Duplicate record.
diffs.splice(equalities[equalitiesLength - 1], 0,
[DIFF_DELETE, lastequality]);
new diff_match_patch.Diff(DIFF_DELETE, lastEquality));
// Change second copy to insert.
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
// Throw away the equality we just deleted.
@@ -774,7 +795,7 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
length_deletions1 = 0;
length_insertions2 = 0;
length_deletions2 = 0;
lastequality = null;
lastEquality = null;
changes = true;
}
}
@@ -805,8 +826,8 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
if (overlap_length1 >= deletion.length / 2 ||
overlap_length1 >= insertion.length / 2) {
// Overlap found. Insert an equality and trim the surrounding edits.
diffs.splice(pointer, 0,
[DIFF_EQUAL, insertion.substring(0, overlap_length1)]);
diffs.splice(pointer, 0, new diff_match_patch.Diff(DIFF_EQUAL,
insertion.substring(0, overlap_length1)));
diffs[pointer - 1][1] =
deletion.substring(0, deletion.length - overlap_length1);
diffs[pointer + 1][1] = insertion.substring(overlap_length1);
@@ -817,8 +838,8 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
overlap_length2 >= insertion.length / 2) {
// Reverse overlap found.
// Insert an equality and swap and trim the surrounding edits.
diffs.splice(pointer, 0,
[DIFF_EQUAL, deletion.substring(0, overlap_length2)]);
diffs.splice(pointer, 0, new diff_match_patch.Diff(DIFF_EQUAL,
deletion.substring(0, overlap_length2)));
diffs[pointer - 1][0] = DIFF_INSERT;
diffs[pointer - 1][1] =
insertion.substring(0, insertion.length - overlap_length2);
@@ -976,7 +997,7 @@ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
var equalities = []; // Stack of indices where equalities are found.
var equalitiesLength = 0; // Keeping our own length var is faster in JS.
/** @type {?string} */
var lastequality = null;
var lastEquality = null;
// Always equal to diffs[equalities[equalitiesLength - 1]][1]
var pointer = 0; // Index of current position.
// Is there an insertion operation before the last equality.
@@ -995,11 +1016,11 @@ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
equalities[equalitiesLength++] = pointer;
pre_ins = post_ins;
pre_del = post_del;
lastequality = diffs[pointer][1];
lastEquality = diffs[pointer][1];
} else {
// Not a candidate, and can never become one.
equalitiesLength = 0;
lastequality = null;
lastEquality = null;
}
post_ins = post_del = false;
} else { // An insertion or deletion.
@@ -1016,16 +1037,16 @@ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
* <ins>A</del>X<ins>C</ins><del>D</del>
* <ins>A</ins><del>B</del>X<del>C</del>
*/
if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||
((lastequality.length < this.Diff_EditCost / 2) &&
if (lastEquality && ((pre_ins && pre_del && post_ins && post_del) ||
((lastEquality.length < this.Diff_EditCost / 2) &&
(pre_ins + pre_del + post_ins + post_del) == 3))) {
// Duplicate record.
diffs.splice(equalities[equalitiesLength - 1], 0,
[DIFF_DELETE, lastequality]);
new diff_match_patch.Diff(DIFF_DELETE, lastEquality));
// Change second copy to insert.
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
equalitiesLength--; // Throw away the equality we just deleted;
lastequality = null;
lastEquality = null;
if (pre_ins && pre_del) {
// No changes made which could affect previous entry, keep going.
post_ins = post_del = true;
@@ -1054,7 +1075,8 @@ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
* @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
*/
diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
// Add a dummy entry at the end.
diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ''));
var pointer = 0;
var count_delete = 0;
var count_insert = 0;
@@ -1086,8 +1108,8 @@ diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
diffs[pointer - count_delete - count_insert - 1][1] +=
text_insert.substring(0, commonlength);
} else {
diffs.splice(0, 0, [DIFF_EQUAL,
text_insert.substring(0, commonlength)]);
diffs.splice(0, 0, new diff_match_patch.Diff(DIFF_EQUAL,
text_insert.substring(0, commonlength)));
pointer++;
}
text_insert = text_insert.substring(commonlength);
@@ -1105,19 +1127,19 @@ diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
}
}
// Delete the offending records and add the merged ones.
if (count_delete === 0) {
diffs.splice(pointer - count_insert,
count_delete + count_insert, [DIFF_INSERT, text_insert]);
} else if (count_insert === 0) {
diffs.splice(pointer - count_delete,
count_delete + count_insert, [DIFF_DELETE, text_delete]);
} else {
diffs.splice(pointer - count_delete - count_insert,
count_delete + count_insert, [DIFF_DELETE, text_delete],
[DIFF_INSERT, text_insert]);
pointer -= count_delete + count_insert;
diffs.splice(pointer, count_delete + count_insert);
if (text_delete.length) {
diffs.splice(pointer, 0,
new diff_match_patch.Diff(DIFF_DELETE, text_delete));
pointer++;
}
pointer = pointer - count_delete - count_insert +
(count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
if (text_insert.length) {
diffs.splice(pointer, 0,
new diff_match_patch.Diff(DIFF_INSERT, text_insert));
pointer++;
}
pointer++;
} else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
// Merge this equality with the previous one.
diffs[pointer - 1][1] += diffs[pointer][1];
@@ -1355,7 +1377,8 @@ diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
switch (tokens[x].charAt(0)) {
case '+':
try {
diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)];
diffs[diffsLength++] =
new diff_match_patch.Diff(DIFF_INSERT, decodeURI(param));
} catch (ex) {
// Malformed URI sequence.
throw new Error('Illegal escape in diff_fromDelta: ' + param);
@@ -1370,9 +1393,9 @@ diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
}
var text = text1.substring(pointer, pointer += n);
if (tokens[x].charAt(0) == '=') {
diffs[diffsLength++] = [DIFF_EQUAL, text];
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL, text);
} else {
diffs[diffsLength++] = [DIFF_DELETE, text];
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE, text);
}
break;
default:
@@ -1575,6 +1598,9 @@ diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
if (text.length == 0) {
return;
}
if (patch.start2 === null) {
throw Error('patch not initialized');
}
var pattern = text.substring(patch.start2, patch.start2 + patch.length1);
var padding = 0;
@@ -1593,13 +1619,13 @@ diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
// Add the prefix.
var prefix = text.substring(patch.start2 - padding, patch.start2);
if (prefix) {
patch.diffs.unshift([DIFF_EQUAL, prefix]);
patch.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, prefix));
}
// Add the suffix.
var suffix = text.substring(patch.start2 + patch.length1,
patch.start2 + patch.length1 + padding);
if (suffix) {
patch.diffs.push([DIFF_EQUAL, suffix]);
patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, suffix));
}
// Roll back the start points.
@@ -1627,9 +1653,9 @@ diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
*
* @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or
* Array of diff tuples for text1 to text2 (method 2).
* @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or
* @param {string|!Array.<!diff_match_patch.Diff>=} opt_b text2 (methods 1,4) or
* Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).
* @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples
* @param {string|!Array.<!diff_match_patch.Diff>=} opt_c Array of diff tuples
* for text1 to text2 (method 4) or undefined (methods 1,2,3).
* @return {!Array.<!diff_match_patch.patch_obj>} Array of Patch objects.
*/
@@ -1718,7 +1744,7 @@ diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {
patch = new diff_match_patch.patch_obj();
patchDiffLength = 0;
// Unlike Unidiff, our patch lists have a rolling context.
// http://code.google.com/p/google-diff-match-patch/wiki/Unidiff
// https://github.com/google/diff-match-patch/wiki/Unidiff
// Update prepatch text & pos to reflect the application of the
// just completed patch.
prepatch_text = postpatch_text;
@@ -1759,7 +1785,8 @@ diff_match_patch.prototype.patch_deepCopy = function(patches) {
var patchCopy = new diff_match_patch.patch_obj();
patchCopy.diffs = [];
for (var y = 0; y < patch.diffs.length; y++) {
patchCopy.diffs[y] = patch.diffs[y].slice();
patchCopy.diffs[y] =
new diff_match_patch.Diff(patch.diffs[y][0], patch.diffs[y][1]);
}
patchCopy.start1 = patch.start1;
patchCopy.start2 = patch.start2;
@@ -1903,7 +1930,7 @@ diff_match_patch.prototype.patch_addPadding = function(patches) {
var diffs = patch.diffs;
if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {
// Add nullPadding equality.
diffs.unshift([DIFF_EQUAL, nullPadding]);
diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding));
patch.start1 -= paddingLength; // Should be 0.
patch.start2 -= paddingLength; // Should be 0.
patch.length1 += paddingLength;
@@ -1923,7 +1950,7 @@ diff_match_patch.prototype.patch_addPadding = function(patches) {
diffs = patch.diffs;
if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {
// Add nullPadding equality.
diffs.push([DIFF_EQUAL, nullPadding]);
diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding));
patch.length1 += paddingLength;
patch.length2 += paddingLength;
} else if (paddingLength > diffs[diffs.length - 1][1].length) {
@@ -1964,7 +1991,7 @@ diff_match_patch.prototype.patch_splitMax = function(patches) {
patch.start2 = start2 - precontext.length;
if (precontext !== '') {
patch.length1 = patch.length2 = precontext.length;
patch.diffs.push([DIFF_EQUAL, precontext]);
patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, precontext));
}
while (bigpatch.diffs.length !== 0 &&
patch.length1 < patch_size - this.Patch_Margin) {
@@ -1983,7 +2010,7 @@ diff_match_patch.prototype.patch_splitMax = function(patches) {
patch.length1 += diff_text.length;
start1 += diff_text.length;
empty = false;
patch.diffs.push([diff_type, diff_text]);
patch.diffs.push(new diff_match_patch.Diff(diff_type, diff_text));
bigpatch.diffs.shift();
} else {
// Deletion or equality. Only take as much as we can stomach.
@@ -1997,7 +2024,7 @@ diff_match_patch.prototype.patch_splitMax = function(patches) {
} else {
empty = false;
}
patch.diffs.push([diff_type, diff_text]);
patch.diffs.push(new diff_match_patch.Diff(diff_type, diff_text));
if (diff_text == bigpatch.diffs[0][1]) {
bigpatch.diffs.shift();
} else {
@@ -2020,7 +2047,7 @@ diff_match_patch.prototype.patch_splitMax = function(patches) {
patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) {
patch.diffs[patch.diffs.length - 1][1] += postcontext;
} else {
patch.diffs.push([DIFF_EQUAL, postcontext]);
patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, postcontext));
}
}
if (!empty) {
@@ -2099,13 +2126,13 @@ diff_match_patch.prototype.patch_fromText = function(textline) {
}
if (sign == '-') {
// Deletion.
patch.diffs.push([DIFF_DELETE, line]);
patch.diffs.push(new diff_match_patch.Diff(DIFF_DELETE, line));
} else if (sign == '+') {
// Insertion.
patch.diffs.push([DIFF_INSERT, line]);
patch.diffs.push(new diff_match_patch.Diff(DIFF_INSERT, line));
} else if (sign == ' ') {
// Minor equality.
patch.diffs.push([DIFF_EQUAL, line]);
patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, line));
} else if (sign == '@') {
// Start of next patch.
break;
@@ -2141,9 +2168,9 @@ diff_match_patch.patch_obj = function() {
/**
* Emmulate GNU diff's format.
* Emulate GNU diff's format.
* Header: @@ -382,8 +481,9 @@
* Indicies are printed as 1-based, not 0-based.
* Indices are printed as 1-based, not 0-based.
* @return {string} The GNU diff string.
*/
diff_match_patch.patch_obj.prototype.toString = function() {
@@ -2183,11 +2210,9 @@ diff_match_patch.patch_obj.prototype.toString = function() {
};
// Export these global variables so that they survive Google's JS compiler.
// In a browser, 'this' will be 'window'.
// Users of node.js should 'require' the uncompressed version since Google's
// JS compiler may break the following exports for non-browser environments.
this['diff_match_patch'] = diff_match_patch;
this['DIFF_DELETE'] = DIFF_DELETE;
this['DIFF_INSERT'] = DIFF_INSERT;
this['DIFF_EQUAL'] = DIFF_EQUAL;
// The following export code was added by @ForbesLindesay
module.exports = diff_match_patch;
module.exports['diff_match_patch'] = diff_match_patch;
module.exports['DIFF_DELETE'] = DIFF_DELETE;
module.exports['DIFF_INSERT'] = DIFF_INSERT;
module.exports['DIFF_EQUAL'] = DIFF_EQUAL;

View File

@@ -1,7 +1,7 @@
////
//// Setup
////
import { diff_match_patch } from './diff_match_patch_uncompressed'
import 'bootstrap/dist/css/bootstrap.min.css';
// dependency for the count of tests running/passed/failed, etc. drives

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Run tests interactively in the browser",
version: '1.3.2',
version: '1.3.3',
documentation: null
});
@@ -19,7 +19,7 @@ Package.onUse(function (api) {
api.use([
'webapp',
'blaze@2.3.4',
'blaze@2.6.1',
'templating@1.3.2',
'spacebars@1.0.15',
'jquery@3.0.0',
@@ -27,8 +27,6 @@ Package.onUse(function (api) {
'tracker',
], 'client');
api.addFiles('diff_match_patch_uncompressed.js', 'client');
api.addFiles([
'driver.html',
'driver.js',

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Dependency tracker to allow reactive callbacks",
version: "1.2.1"
version: "1.3.0"
});
Package.onUse(function (api) {

View File

@@ -32,11 +32,6 @@ Tracker.active = false;
*/
Tracker.currentComputation = null;
function setCurrentComputation(c) {
Tracker.currentComputation = c;
Tracker.active = !! c;
}
function _debugFunc() {
// We want this code to work without Meteor, and also without
// "console" (which is technically non-standard and may be missing
@@ -300,14 +295,13 @@ Tracker.Computation = class Computation {
_compute() {
this.invalidated = false;
var previous = Tracker.currentComputation;
setCurrentComputation(this);
var previousInCompute = inCompute;
inCompute = true;
try {
withNoYieldsAllowed(this._func)(this);
Tracker.withComputation(this, () => {
withNoYieldsAllowed(this._func)(this);
});
} finally {
setCurrentComputation(previous);
inCompute = previousInCompute;
}
}
@@ -597,12 +591,20 @@ Tracker.autorun = function (f, options) {
* @param {Function} func A function to call immediately.
*/
Tracker.nonreactive = function (f) {
var previous = Tracker.currentComputation;
setCurrentComputation(null);
return Tracker.withComputation(null, f);
};
Tracker.withComputation = function (computation, f) {
var previousComputation = Tracker.currentComputation;
Tracker.currentComputation = computation;
Tracker.active = !!computation;
try {
return f();
} finally {
setCurrentComputation(previous);
Tracker.currentComputation = previousComputation;
Tracker.active = !!previousComputation;
}
};

View File

@@ -518,6 +518,118 @@ testAsyncMulti('tracker - Tracker.autorun, onError option', [function (test, exp
Tracker.flush();
}]);
Tinytest.addAsync('tracker - async function - basics', function (test, onComplete) {
const computation = Tracker.autorun(async function (computation) {
test.equal(computation.firstRun, true, 'before (firstRun)');
test.equal(Tracker.currentComputation, computation, 'before');
const x = await Promise.resolve().then(() =>
Tracker.withComputation(computation, () => {
// The `firstRun` is `false` as soon as the first `await` happens.
test.equal(computation.firstRun, false, 'inside (firstRun)');
test.equal(Tracker.currentComputation, computation, 'inside');
return 123;
})
);
test.equal(x, 123, 'await (value)');
test.equal(computation.firstRun, false, 'await (firstRun)');
Tracker.withComputation(computation, () => {
test.equal(Tracker.currentComputation, computation, 'await');
});
await new Promise(resolve => setTimeout(resolve, 10));
Tracker.withComputation(computation, () => {
test.equal(computation.firstRun, false, 'sleep (firstRun)');
test.equal(Tracker.currentComputation, computation, 'sleep');
});
try {
await Promise.reject('example');
test.fail();
} catch (error) {
Tracker.withComputation(computation, () => {
test.equal(error, 'example', 'catch (error)');
test.equal(computation.firstRun, false, 'catch (firstRun)');
test.equal(Tracker.currentComputation, computation, 'catch');
});
}
onComplete();
});
test.equal(Tracker.currentComputation, null, 'outside (computation)');
test.instanceOf(computation, Tracker.Computation, 'outside (result)');
});
Tinytest.addAsync('tracker - async function - interleaved', async function (test) {
let count = 0;
const limit = 100;
for (let index = 0; index < limit; ++index) {
Tracker.autorun(async function (computation) {
test.equal(Tracker.currentComputation, computation, `before (${index})`);
await new Promise(resolve => setTimeout(resolve, Math.random() * limit));
count++;
Tracker.withComputation(computation, () => {
test.equal(Tracker.currentComputation, computation, `after (${index})`);
});
});
}
test.equal(count, 0, 'before resolve');
await new Promise(resolve => setTimeout(resolve, limit));
test.equal(count, limit, 'after resolve');
});
Tinytest.addAsync('tracker - async function - parallel', async function (test) {
let resolvePromise;
const promise = new Promise(resolve => {
resolvePromise = resolve;
});
let count = 0;
const limit = 100;
const dependency = new Tracker.Dependency();
for (let index = 0; index < limit; ++index) {
Tracker.autorun(async function (computation) {
count++;
Tracker.withComputation(computation, () => {
dependency.depend();
});
await promise;
count--;
});
}
test.equal(count, limit, 'before');
dependency.changed();
await new Promise(setTimeout);
test.equal(count, limit * 2, 'changed');
resolvePromise();
await new Promise(setTimeout);
test.equal(count, 0, 'after');
});
Tinytest.addAsync('tracker - async function - stepped', async function (test) {
let resolvePromise;
const promise = new Promise(resolve => {
resolvePromise = resolve;
});
let count = 0;
const limit = 100;
for (let index = 0; index < limit; ++index) {
Tracker.autorun(async function (computation) {
test.equal(Tracker.currentComputation, computation, `before (${index})`);
await promise;
count++;
Tracker.withComputation(computation, () => {
test.equal(Tracker.currentComputation, computation, `after (${index})`);
});
});
}
test.equal(count, 0, 'before resolve');
resolvePromise();
await new Promise(setTimeout);
test.equal(count, limit, 'after resolve');
});
Tinytest.add('computation - #flush', function (test) {
var i = 0, j = 0, d = new Tracker.Dependency;
var c1 = Tracker.autorun(function () {

View File

@@ -1,6 +1,6 @@
Package.describe({
name: 'typescript',
version: '4.6.4',
version: '4.7.4',
summary:
'Compiler plugin that compiles TypeScript and ECMAScript in .ts and .tsx files',
documentation: 'README.md',

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'Serves a Meteor app over HTTP',
version: '1.13.2',
version: '1.13.3',
});
Npm.depends({

View File

@@ -429,10 +429,11 @@ function getBoilerplateAsync(request, arch) {
encodedCurrentConfig: boilerplate.baseData.meteorRuntimeConfig,
updated: runtimeConfig.isUpdatedByArch[arch],
});
if (!meteorRuntimeConfig) return;
if (!meteorRuntimeConfig) return true;
boilerplate.baseData = Object.assign({}, boilerplate.baseData, {
meteorRuntimeConfig,
});
return true;
});
runtimeConfig.isUpdatedByArch[arch] = false;
const data = Object.assign(
@@ -509,6 +510,7 @@ WebAppInternals.generateBoilerplateInstance = function(
};
runtimeConfig.updateHooks.forEach(cb => {
cb({ arch, manifest, runtimeConfig: rtimeConfig });
return true;
});
const meteorRuntimeConfig = JSON.stringify(

View File

@@ -1,6 +1,6 @@
{
"track": "METEOR",
"version": "2.9.0",
"version": "2.10.0-rc.0",
"recommended": false,
"official": false,
"description": "Meteor experimental release"

View File

@@ -1,6 +1,6 @@
{
"track": "METEOR",
"version": "2.9.0",
"version": "2.10.0",
"recommended": false,
"official": true,
"description": "The Official Meteor Distribution"

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd ../../..
git rev-parse --abbrev-ref HEAD

View File

@@ -9,6 +9,11 @@ const fs = require('fs');
const { exec } = require("child_process");
const { readdir } = require("fs/promises");
/**
*
* @param command
* @return {Promise<string>}
*/
const runCommand = async (command) => {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
@@ -34,6 +39,22 @@ const runCommand = async (command) => {
async function getPackages() {
return await runCommand("./get-diff.sh");
}
async function getReleaseNumber() {
// only works if you are in the release branch. it will return someting
// like release-2.4 or release-2.4.2
const gitBranch = await runCommand("./get-branch-name.sh");
if (!gitBranch.includes('release')) throw new Error('You are not in a release branch');
const releaseNumber = gitBranch
.replace('release-', '')
.replace('.', '')
.replace('\n', '');
// this is when we have release-2.4 and we want to make sure that we have release-2.4.0
if (gitBranch.match(/\./g).length === 1) return `${ releaseNumber }0`;
return releaseNumber;
}
async function getFile(path) {
try {
@@ -56,7 +77,7 @@ async function main() {
* @type {string[]}
*/
let args = process.argv.slice(2);
const releaseNumber = await getReleaseNumber();
if (args[0].startsWith('@all')) {
const [_, type] = args[0].split('.');
const allPackages = await getDirectories('../../../packages');
@@ -119,7 +140,9 @@ async function main() {
*/
function incrementNewVersion(release) {
if (release.includes('beta') || release.includes('rc')) {
return semver.inc(currentVersion, 'prerelease', release);
const version =
semver.inc(currentVersion, 'prerelease', release);
return version.replace(release, `${release}${releaseNumber}`);
}
return semver.inc(currentVersion, release);
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ set -u
UNAME=$(uname)
ARCH=$(uname -m)
NODE_VERSION=14.21.1
NODE_VERSION=14.21.2
MONGO_VERSION_64BIT=5.0.5
MONGO_VERSION_32BIT=3.2.22
NPM_VERSION=6.14.17

View File

@@ -14,8 +14,8 @@ var packageJson = {
pacote: "https://github.com/meteor/pacote/tarball/a81b0324686e85d22c7688c47629d4009000e8b8",
"node-gyp": "8.0.0",
"node-pre-gyp": "0.15.0",
typescript: "4.5.4",
"@meteorjs/babel": "7.18.0-beta.4",
typescript: "4.7.4",
"@meteorjs/babel": "7.18.0-beta.5",
"@meteorjs/reify": "0.24.0",
// So that Babel can emit require("@babel/runtime/helpers/...") calls.
"@babel/runtime": "7.15.3",

View File

@@ -931,7 +931,7 @@ main.registerCommand({
return;
}
toPublish.push(packageName);
Console.info("Will publish new version for " + packageName);
Console.info(`Will publish new version for ${ packageName }: ${ packageSource.version }`);
return;
} else {
var isopk = projectContext.isopackCache.getIsopack(packageName);

View File

@@ -524,6 +524,7 @@ export const AVAILABLE_SKELETONS = [
DEFAULT_SKELETON,
"typescript",
"vue",
'vue-2',
"svelte",
"tailwind",
"chakra-ui",

View File

@@ -1,7 +1,7 @@
// This file contains an old definition of CompileStep, an object that is passed
// to the package-provided file handler.
// Since then, the newer API called "Batch Plugins" have replaced it but we keep
// the functionality for the backwards-compitability.
// the functionality for the backwards-compatibility.
// @deprecated
// XXX COMPAT WITH 1.1.0.2

View File

@@ -1,8 +1,10 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import { App } from '/imports/ui/App';
Meteor.startup(() => {
render(<App/>, document.getElementById('react-target'));
const container = document.getElementById('react-target');
const root = createRoot(container);
root.render(<App />);
});

View File

@@ -8,12 +8,12 @@
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"@apollo/client": "^3.6.9",
"@babel/runtime": "^7.18.6",
"@apollo/client": "^3.7.3",
"@babel/runtime": "^7.20.7",
"apollo-server-express": "^3.10.0",
"express": "^4.18.1",
"graphql": "^15.8.0",
"meteor-node-stubs": "^1.2.3",
"graphql": "^16.6.0",
"meteor-node-stubs": "^1.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},

View File

@@ -1,8 +1,10 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import { App } from '/imports/ui/App';
Meteor.startup(() => {
render(<App/>, document.getElementById('react-target'));
const container = document.getElementById('react-target');
const root = createRoot(container);
root.render(<App />);
});

View File

@@ -8,10 +8,10 @@
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"meteor-node-stubs": "^1.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"@babel/runtime": "^7.20.7",
"meteor-node-stubs": "^1.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"meteor": {
"mainModule": {

View File

@@ -7,7 +7,6 @@
meteor-base # Packages every Meteor app needs to have
mobile-experience # Packages for a great mobile UX
mongo # The database Meteor supports right now
reactive-var # Reactive variable for tracker
standard-minifier-css # CSS minifier run for production mode
standard-minifier-js # JS minifier run for production mode
@@ -19,5 +18,5 @@ shell-server # Server-side component of the `meteor shell` command
~prototype~
static-html # Define static page content in .html files
zodern:melte # Meteor package to allow us to create files with the .svelte extension
rdb:svelte-meteor-data # Meteor package which allows us to consume Meteor's reactive data sources inside of our Svelte components
hot-module-replacement # Update client in development without reloading the page
zodern:types # Enable types from meteor/atmosphere packages

View File

@@ -1,8 +1,21 @@
<script>
import { Meteor } from "meteor/meteor";
import { LinksCollection } from '../api/links';
let counter = 0;
const addToCounter = () => {
counter += 1;
}
let subIsReady = false;
$m: {
const handle = Meteor.subscribe("links.all");
subIsReady = handle.ready();
}
// more information about $m at https://atmospherejs.com/zodern/melte#tracker-statements
let links;
$m: links = LinksCollection.find().fetch();
</script>
@@ -13,10 +26,15 @@
<p>You've pressed the button {counter} times.</p>
<h2>Learn Meteor!</h2>
<ul>
<li><a href="https://svelte-tutorial.meteor.com/" target="_blank">Do the Tutorial</a></li>
<li><a href="http://guide.meteor.com" target="_blank">Follow the Guide</a></li>
<li><a href="https://docs.meteor.com" target="_blank">Read the Docs</a></li>
<li><a href="https://forums.meteor.com" target="_blank">Discussions</a></li>
</ul>
{#if subIsReady}
<ul>
{#each links as link (link._id)}
<li><a href={link.url} target="_blank" rel="noreferrer">{link.title}</a></li>
{/each}
</ul>
{:else}
<div>Loading ...</div>
{/if}
<h2>Typescript ready</h2>
<p>Just add lang="ts" to .svelte components.</p>
</div>

View File

@@ -8,9 +8,12 @@
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"meteor-node-stubs": "^1.2.1",
"svelte": "^3.46.4"
"@babel/runtime": "^7.20.6",
"meteor-node-stubs": "^1.2.5",
"svelte": "^3.54.0"
},
"devDependencies": {
"svelte-preprocess": "^5.0.0"
},
"meteor": {
"mainModule": {

View File

@@ -5,6 +5,10 @@ async function insertLink({ title, url }) {
await LinksCollection.insertAsync({ title, url, createdAt: new Date() });
}
Meteor.publish('links.all', function publishLinksAll() {
return LinksCollection.find();
})
Meteor.startup(async () => {
// If the Links collection is empty, add some data.
if (await LinksCollection.find().countAsync() === 0) {

View File

@@ -0,0 +1,20 @@
{
// see https://guide.meteor.com/build-tool.html#typescript for a config example
"compilerOptions": {
"allowSyntheticDefaultImports": true, // to be able to import eg meteor/mongo
"baseUrl": ".", // required by "paths"
"module": "esNext", // required by "preserveValueImports"
"moduleResolution": "node", // required by zodern:types (not documented)
"paths": {
"/*": ["*"], // support absolute /imports/* with a leading '/'
// support Meteor/Atmospehere packages, required by zodern:types
"meteor/*": [
"node_modules/@types/meteor/*",
".meteor/local/types/packages.d.ts"
]
},
"preserveSymlinks": true, // required by zodern:types
"preserveValueImports": true // otherwise TS will remove imported components
},
"exclude": ["./.meteor/**", "./packages/**"] // this may solve VS Code Svelte plugin warnings
}

View File

@@ -1,8 +1,10 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import { App } from '/imports/ui/App'
import { App } from '/imports/ui/App';
Meteor.startup(() => {
render(<App />, document.getElementById('react-target'));
const container = document.getElementById('react-target');
const root = createRoot(container!);
root.render(<App />);
});

View File

@@ -8,17 +8,17 @@
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"meteor-node-stubs": "^1.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"@babel/runtime": "^7.20.7",
"meteor-node-stubs": "^1.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/meteor": "^1.4.87",
"@types/mocha": "^8.2.3",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"typescript": "^4.6.4"
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"typescript": "^4.7.4"
},
"meteor": {
"mainModule": {

View File

@@ -7,7 +7,7 @@
meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.1.0 # Packages for a great mobile UX
mongo@1.9.0 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
blaze-html-templates@2.0.0! # Compile .html files into Meteor Blaze views
reactive-var@1.0.12 # Reactive variable for tracker
tracker@1.2.1 # Meteor's client-side reactive programming library

View File

@@ -7,7 +7,7 @@
meteor-base # Packages every Meteor app needs to have
mobile-experience # Packages for a great mobile UX
mongo # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
blaze-html-templates@2.0.0! # Compile .html files into Meteor Blaze views
reactive-var # Reactive variable for tracker
jquery # Helpful client-side library
tracker # Meteor's client-side reactive programming library

View File

@@ -75,7 +75,7 @@ Object.assign(Job.prototype, {
}
line += ": ";
} else {
// not sure how to display messages without a filenanme.. try this?
// not sure how to display messages without a file name.. try this?
line += "error: ";
}
// XXX line wrapping would be nice..