Meteor 1.6.1

This commit is contained in:
SachaG 2018-01-27 16:12:06 +09:00
parent 8602bdcc27
commit e8164585b3
15 changed files with 390 additions and 220 deletions

View file

@ -9,7 +9,7 @@ vulcan:i18n-en-us
############ Accounts Packages ############
accounts-password@1.4.0
accounts-password@1.5.0
# accounts-twitter
# accounts-facebook

View file

@ -1 +1 @@
METEOR@1.6
METEOR@1.6.1

View file

@ -1,82 +1,90 @@
accounts-base@1.4.2
accounts-password@1.5.0
allow-deny@1.1.0
autoupdate@1.3.12
babel-compiler@6.24.7
babel-runtime@1.1.1
autoupdate@1.4.0
babel-compiler@7.0.0
babel-runtime@1.2.0
base64@1.0.10
binary-heap@1.0.10
boilerplate-generator@1.3.0
boilerplate-generator@1.4.0
buffer@0.0.0
caching-compiler@1.1.9
callback-hook@1.0.10
check@1.2.5
callback-hook@1.1.0
check@1.3.0
ddp@1.4.0
ddp-client@2.2.0
ddp-common@1.3.0
ddp-client@2.3.1
ddp-common@1.4.0
ddp-rate-limiter@1.0.7
ddp-server@2.1.1
diff-sequence@1.0.7
dynamic-import@0.2.1
ecmascript@0.9.0
ddp-server@2.1.2
diff-sequence@1.1.0
dynamic-import@0.3.0
ecmascript@0.10.0
ecmascript-runtime@0.5.0
ecmascript-runtime-client@0.5.0
ecmascript-runtime-client@0.6.0
ecmascript-runtime-server@0.5.0
ejson@1.1.0
email@1.2.3
example-simple@0.0.0
es5-shim@4.7.3
example-forum@1.8.5
fourseven:scss@4.5.4
geojson-utils@1.0.10
hot-code-push@1.0.4
http@1.3.0
id-map@1.0.9
http@1.4.0
id-map@1.1.0
livedata@1.0.18
localstorage@1.2.0
logging@1.1.19
meteor@1.8.2
meteor-base@1.2.0
meteor-base@1.3.0
meteorhacks:inject-initial@1.0.4
meteorhacks:picker@1.0.3
minifier-css@1.2.16
minifier-js@2.2.2
minifier-css@1.3.0
minifier-js@2.3.1
minimongo@1.4.3
modules@0.11.2
modules@0.11.3
modules-runtime@0.9.1
mongo@1.3.1
mongo@1.4.2
mongo-dev-server@1.1.0
mongo-id@1.0.6
npm-bcrypt@0.9.3
npm-mongo@2.2.33
ordered-dict@1.0.9
ordered-dict@1.1.0
percolatestudio:synced-cron@1.1.0
promise@0.10.1
random@1.0.10
random@1.1.0
rate-limit@1.0.8
reactive-dict@1.2.0
reactive-var@1.0.11
reload@1.1.11
retry@1.0.9
reload@1.2.0
retry@1.1.0
routepolicy@1.0.12
server-render@0.3.0
service-configuration@1.0.11
session@1.1.7
sha@1.0.9
shell-server@0.3.1
shim-common@0.1.0
socket-stream-client@0.1.0
srp@1.0.10
standard-minifier-css@1.3.5
standard-minifier-js@2.2.3
standard-minifier-css@1.4.0
standard-minifier-js@2.3.1
standard-minifiers@1.1.0
tracker@1.1.3
underscore@1.0.10
url@1.1.0
url@1.2.0
vulcan:accounts@1.8.5
vulcan:core@1.8.5
vulcan:debug@1.8.5
vulcan:email@1.8.5
vulcan:embed@1.8.5
vulcan:events@1.8.5
vulcan:forms@1.8.5
vulcan:i18n@1.8.5
vulcan:i18n-en-us@1.8.5
vulcan:lib@1.8.5
vulcan:newsletter@1.8.5
vulcan:routing@1.8.5
vulcan:users@1.8.5
webapp@1.4.0
vulcan:voting@1.8.5
webapp@1.5.0
webapp-hashing@1.0.9

139
package-lock.json generated
View file

@ -4,6 +4,15 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/runtime": {
"version": "7.0.0-beta.38",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.38.tgz",
"integrity": "sha512-ZvPtlcvH2ZRzr1U5pkmCE7U3RIun3Nf29XHem47aScmJgMuL06ulkp+4oPBee3QrUVFErDjwNWtC67BzNuxLVw==",
"requires": {
"core-js": "2.5.1",
"regenerator-runtime": "0.11.1"
}
},
"@segment/loosely-validate-event": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-1.1.2.tgz",
@ -837,6 +846,11 @@
"lazy-cache": "1.0.4"
}
},
"chain-function": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/chain-function/-/chain-function-1.0.0.tgz",
"integrity": "sha1-DUqzfn4Y6tC9xHuSB2QRjOWHM9w="
},
"chalk": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.2.0.tgz",
@ -1908,6 +1922,16 @@
}
}
},
"eslint-plugin-prettier": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.5.0.tgz",
"integrity": "sha512-L06bewYpt2Wb8Uk7os8f/0cL5DjddL38t1M/nOpjw5MqVFBn1RIIBBE6tfr37lHUH7AvAubZsvu/bDmNl4RBKQ==",
"dev": true,
"requires": {
"fast-diff": "1.1.2",
"jest-docblock": "21.2.0"
}
},
"eslint-plugin-react": {
"version": "6.10.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz",
@ -2085,6 +2109,12 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8="
},
"fast-diff": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.1.2.tgz",
"integrity": "sha512-KaJUt+M9t1qaIteSvjc6P3RbMdXsNhK61GRftR6SNxqmhthcd9MGIi4T+o0jD8LUSpSnSKXE20nLtJ3fOHxQig==",
"dev": true
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
@ -2226,11 +2256,12 @@
}
},
"formsy-react-components": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/formsy-react-components/-/formsy-react-components-0.10.1.tgz",
"integrity": "sha1-ahFE5a2AGgLrzkxG5QM+juMFxBw=",
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/formsy-react-components/-/formsy-react-components-0.11.1.tgz",
"integrity": "sha1-ucMGytfeQR92UaVsd1XY9Oabm5M=",
"requires": {
"classnames": "2.2.5"
"classnames": "2.2.5",
"prop-types": "15.6.0"
}
},
"forwarded": {
@ -2974,6 +3005,12 @@
"resolved": "https://registry.npmjs.org/iterall/-/iterall-1.1.3.tgz",
"integrity": "sha512-Cu/kb+4HiNSejAPhSaN1VukdNTTi/r4/e+yykqjlG/IW+1gZH5b4+Bq3whDX4tvbYugta3r8KTMUiqT3fIGxuQ=="
},
"jest-docblock": {
"version": "21.2.0",
"resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz",
"integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==",
"dev": true
},
"join-component": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/join-component/-/join-component-1.1.0.tgz",
@ -4630,11 +4667,10 @@
}
},
"react": {
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/react/-/react-15.6.2.tgz",
"integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=",
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/react/-/react-16.2.0.tgz",
"integrity": "sha512-ZmIomM7EE1DvPEnSFAHZn9Vs9zJl5A9H7el0EGTE6ZbW9FKe/14IYAlPbC8iH25YarEQxZL+E8VW7Mi7kfQrDQ==",
"requires": {
"create-react-class": "15.6.2",
"fbjs": "0.8.16",
"loose-envify": "1.3.1",
"object-assign": "4.1.1",
@ -4666,9 +4702,9 @@
}
},
"react-bootstrap": {
"version": "0.31.5",
"resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-0.31.5.tgz",
"integrity": "sha512-xgDihgX4QvYHmHzL87faDBMDnGfYyqcrqV0TEbWY+JizePOG1vfb8M3xJN+6MJ3kUYqDtQSZ7v/Q6Y5YDrkMdA==",
"version": "0.32.1",
"resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-0.32.1.tgz",
"integrity": "sha512-RbfzKUbsukWsToWqGHfCCyMFq9QQI0TznutdyxyJw6dih2NvIne25Mrssg8LZsprqtPpyQi8bN0L0Fx3fUsL8Q==",
"requires": {
"babel-runtime": "6.26.0",
"classnames": "2.2.5",
@ -4677,9 +4713,26 @@
"keycode": "2.1.9",
"prop-types": "15.6.0",
"prop-types-extra": "1.0.1",
"react-overlays": "0.7.4",
"react-overlays": "0.8.3",
"react-prop-types": "0.4.0",
"react-transition-group": "2.2.1",
"uncontrollable": "4.1.0",
"warning": "3.0.0"
},
"dependencies": {
"react-overlays": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-0.8.3.tgz",
"integrity": "sha512-h6GT3jgy90PgctleP39Yu3eK1v9vaJAW73GOA/UbN9dJ7aAN4BTZD6793eI1D5U+ukMk17qiqN/wl3diK1Z5LA==",
"requires": {
"classnames": "2.2.5",
"dom-helpers": "3.3.1",
"prop-types": "15.6.0",
"prop-types-extra": "1.0.1",
"react-transition-group": "2.2.1",
"warning": "3.0.0"
}
}
}
},
"react-bootstrap-datetimepicker": {
@ -4734,9 +4787,9 @@
}
},
"react-dom": {
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.6.2.tgz",
"integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=",
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.2.0.tgz",
"integrity": "sha512-zpGAdwHVn9K0091d+hr+R0qrjoJ84cIBFL2uU60KvWBPfZ7LPSrfqviTxGHWN0sjPZb2hxWzMexwrvJdKePvjg==",
"requires": {
"fbjs": "0.8.16",
"loose-envify": "1.3.1",
@ -4802,18 +4855,6 @@
"resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.7.0.tgz",
"integrity": "sha512-IBivBP7xayM7SbbVlAnKgHgoWdfCVqnNBNgQRY5x9iFQm55tFdolR02hX1fCJJtTEKnbaL1stB72/TZc6+p2+Q=="
},
"react-overlays": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-0.7.4.tgz",
"integrity": "sha512-7vsooMx3siLAuEfTs8FYeP/lAORWWFXTO8PON3KgX0Htq1Oa+po6ioSjGyO0/GO5CVSMNhpWt6V2opeexHgBuQ==",
"requires": {
"classnames": "2.2.5",
"dom-helpers": "3.3.1",
"prop-types": "15.6.0",
"prop-types-extra": "1.0.1",
"warning": "3.0.0"
}
},
"react-places-autocomplete": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/react-places-autocomplete/-/react-places-autocomplete-5.4.3.tgz",
@ -4823,6 +4864,14 @@
"prop-types": "15.6.0"
}
},
"react-prop-types": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/react-prop-types/-/react-prop-types-0.4.0.tgz",
"integrity": "sha1-+ZsL+0AGkpya8gUefBQUpcdbk9A=",
"requires": {
"warning": "3.0.0"
}
},
"react-reconciler": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.7.0.tgz",
@ -4910,6 +4959,19 @@
"prop-types": "15.6.0"
}
},
"react-transition-group": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-2.2.1.tgz",
"integrity": "sha512-q54UBM22bs/CekG8r3+vi9TugSqh0t7qcEVycaRc9M0p0aCEu+h6rp/RFiW7fHfgd1IKpd9oILFTl5QK+FpiPA==",
"requires": {
"chain-function": "1.0.0",
"classnames": "2.2.5",
"dom-helpers": "3.3.1",
"loose-envify": "1.3.1",
"prop-types": "15.6.0",
"warning": "3.0.0"
}
},
"read-pkg": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
@ -4977,21 +5039,14 @@
}
},
"recompose": {
"version": "0.21.2",
"resolved": "https://registry.npmjs.org/recompose/-/recompose-0.21.2.tgz",
"integrity": "sha1-/z+9sjl7HHfEfUUb4qY7kpXURoE=",
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/recompose/-/recompose-0.26.0.tgz",
"integrity": "sha512-KwOu6ztO0mN5vy3+zDcc45lgnaUoaQse/a5yLVqtzTK13czSWnFGmXbQVmnoMgDkI5POd1EwIKSbjU1V7xdZog==",
"requires": {
"change-emitter": "0.1.6",
"fbjs": "0.8.16",
"hoist-non-react-statics": "1.2.0",
"hoist-non-react-statics": "2.3.1",
"symbol-observable": "1.1.0"
},
"dependencies": {
"hoist-non-react-statics": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz",
"integrity": "sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs="
}
}
},
"redux": {
@ -5483,7 +5538,7 @@
"extend": "3.0.1",
"message-box": "0.1.1",
"mongo-object": "0.0.2",
"underscore": "1.8.4"
"underscore": "1.8.3"
}
},
"slash": {
@ -5952,7 +6007,7 @@
"integrity": "sha1-RYXfzPn85O8O7jG6vJ5NGQ6gzqo=",
"requires": {
"babel-runtime": "6.26.0",
"react": "15.6.2"
"react": "16.2.0"
}
},
"trim": {
@ -6049,8 +6104,8 @@
}
},
"underscore": {
"version": "1.8.4",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.4.tgz",
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
},
"underscore.string": {

View file

@ -9,6 +9,7 @@
"lint": "eslint --cache --ext .jsx,js packages"
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.38",
"analytics-node": "^2.1.1",
"apollo-client": "^1.2.2",
"apollo-engine": "^0.5.4",
@ -96,6 +97,7 @@
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-meteor": "^4.0.1",
"eslint-plugin-prettier": "^2.5.0",
"eslint-plugin-react": "^6.7.1"
},
"postcss": {

View file

@ -0,0 +1 @@
.build*

View file

@ -0,0 +1 @@
node_modules

View file

@ -0,0 +1,7 @@
This directory and the files immediately inside it are automatically generated
when you change this package's NPM dependencies. Commit the files in this
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control
so that others run the same versions of sub-dependencies.
You should NOT check in the node_modules directory that Meteor automatically
creates; if you are using git, the .gitignore file tells git to ignore it.

View file

@ -0,0 +1,30 @@
{
"lockfileVersion": 1,
"dependencies": {
"bluebird": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
"integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE="
},
"combined-stream2": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/combined-stream2/-/combined-stream2-1.1.2.tgz",
"integrity": "sha1-9uFLegFWZvjHsKH6xQYkAWSsNXA="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"stream-length": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/stream-length/-/stream-length-1.0.2.tgz",
"integrity": "sha1-gnfzy+5JpNqrz9tOL0qbXp8snwA="
}
}
}

View file

@ -0,0 +1,5 @@
# boilerplate-generator
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/boilerplate-generator) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/boilerplate-generator)
***
This is an internal Meteor package.

View file

@ -1,4 +1,5 @@
import { readFile } from 'fs';
import { create as createStream } from "combined-stream2";
import WebBrowserTemplate from './template-web.browser';
import WebCordovaTemplate from './template-web.cordova';
@ -6,9 +7,24 @@ import WebCordovaTemplate from './template-web.cordova';
// Copied from webapp_server
const readUtf8FileSync = filename => Meteor.wrapAsync(readFile)(filename, 'utf8');
const identity = value => value;
function appendToStream(chunk, stream) {
if (typeof chunk === "string") {
stream.append(Buffer.from(chunk, "utf8"));
} else if (Buffer.isBuffer(chunk) ||
typeof chunk.read === "function") {
stream.append(chunk);
}
}
let shouldWarnAboutToHTMLDeprecation = ! Meteor.isProduction;
export class Boilerplate {
constructor(arch, manifest, options = {}) {
this.template = _getTemplate(arch);
const { headTemplate, closeTemplate } = _getTemplate(arch);
this.headTemplate = headTemplate;
this.closeTemplate = closeTemplate;
this.baseData = null;
this._generateBoilerplateFromManifest(
@ -17,17 +33,64 @@ export class Boilerplate {
);
}
toHTML(extraData) {
if (shouldWarnAboutToHTMLDeprecation) {
shouldWarnAboutToHTMLDeprecation = false;
console.error(
"The Boilerplate#toHTML method has been deprecated. " +
"Please use Boilerplate#toHTMLStream instead."
);
console.trace();
}
// Calling .await() requires a Fiber.
return toHTMLAsync(extraData).await();
}
// Returns a Promise that resolves to a string of HTML.
toHTMLAsync(extraData) {
return new Promise((resolve, reject) => {
const stream = this.toHTMLStream(extraData);
const chunks = [];
stream.on("data", chunk => chunks.push(chunk));
stream.on("end", () => {
resolve(Buffer.concat(chunks).toString("utf8"));
});
stream.on("error", reject);
});
}
// The 'extraData' argument can be used to extend 'self.baseData'. Its
// purpose is to allow you to specify data that you might not know at
// the time that you construct the Boilerplate object. (e.g. it is used
// by 'webapp' to specify data that is only known at request-time).
toHTML(extraData) {
if (!this.baseData || !this.template) {
// this returns a stream
toHTMLStream(extraData) {
if (!this.baseData || !this.headTemplate || !this.closeTemplate) {
throw new Error('Boilerplate did not instantiate correctly.');
}
return "<!DOCTYPE html>\n" +
this.template({ ...this.baseData, ...extraData });
const data = {...this.baseData, ...extraData};
const start = "<!DOCTYPE html>\n" + this.headTemplate(data);
const { body, dynamicBody } = data;
const end = this.closeTemplate(data);
const response = createStream();
appendToStream(start, response);
if (body) {
appendToStream(body, response);
}
if (dynamicBody) {
appendToStream(dynamicBody, response);
}
appendToStream(end, response);
return response;
}
// XXX Exported to allow client-side only changes to rebuild the boilerplate
@ -38,8 +101,8 @@ export class Boilerplate {
// Optionally takes pathMapper for resolving relative file system paths.
// Optionally allows to override fields of the data context.
_generateBoilerplateFromManifest(manifest, {
urlMapper = _.identity,
pathMapper = _.identity,
urlMapper = identity,
pathMapper = identity,
baseDataExtension,
inline,
} = {}) {
@ -53,7 +116,7 @@ export class Boilerplate {
...baseDataExtension,
};
_.each(manifest, item => {
manifest.forEach(item => {
const urlPath = urlMapper(item.url);
const itemObj = { url: urlPath };

View file

@ -1,14 +1,15 @@
Package.describe({
name: "boilerplate-generator",
summary: "Generates the boilerplate html from program's manifest",
version: '1.3.0'
version: '1.4.0'
});
Npm.depends({
"combined-stream2": "1.1.2"
});
Package.onUse(api => {
api.use('ecmascript');
api.use([
'underscore',
], 'server');
api.use('underscore', 'server');
api.mainModule('generator.js', 'server');
api.export('Boilerplate', 'server');
});
});

View file

@ -1,79 +1,69 @@
// Template function for rendering the boilerplate html for browsers
import template from './template';
export default function({
meteorRuntimeConfig,
rootUrlPathPrefix,
inlineScriptsAllowed,
export const headTemplate = ({
css,
js,
additionalStaticJs,
htmlAttributes,
bundledJsCssUrlRewriteHook,
head,
body,
dynamicHead,
dynamicBody,
}) {
return [].concat(
[
'<html' +_.map(htmlAttributes, (value, key) =>
_.template(' <%= attrName %>="<%- attrValue %>"')({
attrName: key,
attrValue: value
})
).join('') + '>',
'<head>'
],
}) => [
'<html' + Object.keys(htmlAttributes || {}).map(
key => template(' <%= attrName %>="<%- attrValue %>"')({
attrName: key,
attrValue: htmlAttributes[key],
})
).join('') + '>',
'<head>',
[
head,
dynamicHead,
],
...(css || []).map(file =>
template(' <link rel="stylesheet" type="text/css" class="__meteor-css__" href="<%- href %>">')({
href: bundledJsCssUrlRewriteHook(file.url),
})
),
_.map(css, ({url}) =>
_.template(' <link rel="stylesheet" type="text/css" class="__meteor-css__" href="<%- href %>">')({
href: bundledJsCssUrlRewriteHook(url)
head,
dynamicHead,
'</head>',
'<body>',
].join('\n');
// Template function for rendering the boilerplate html for browsers
export const closeTemplate = ({
meteorRuntimeConfig,
rootUrlPathPrefix,
inlineScriptsAllowed,
js,
additionalStaticJs,
bundledJsCssUrlRewriteHook,
}) => [
'',
inlineScriptsAllowed
? template(' <script type="text/javascript">__meteor_runtime_config__ = JSON.parse(decodeURIComponent(<%= conf %>))</script>')({
conf: meteorRuntimeConfig,
})
: template(' <script type="text/javascript" src="<%- src %>/meteor_runtime_config.js"></script>')({
src: rootUrlPathPrefix,
}),
'',
...(js || []).map(file =>
template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: bundledJsCssUrlRewriteHook(file.url),
})
),
...(additionalStaticJs || []).map(({ contents, pathname }) => (
inlineScriptsAllowed
? template(' <script><%= contents %></script>')({
contents,
})
),
[
'</head>',
'<body>',
body,
dynamicBody,
'',
(inlineScriptsAllowed
? _.template(' <script type="text/javascript">__meteor_runtime_config__ = JSON.parse(decodeURIComponent(<%= conf %>))</script>')({
conf: meteorRuntimeConfig
})
: _.template(' <script type="text/javascript" src="<%- src %>/meteor_runtime_config.js"></script>')({
src: rootUrlPathPrefix
})
) ,
''
],
_.map(js, ({url}) =>
_.template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: bundledJsCssUrlRewriteHook(url)
: template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: rootUrlPathPrefix + pathname,
})
),
_.map(additionalStaticJs, ({contents, pathname}) => (
(inlineScriptsAllowed
? _.template(' <script><%= contents %></script>')({
contents: contents
})
: _.template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: rootUrlPathPrefix + pathname
}))
)),
[
'', '',
'</body>',
'</html>'
],
).join('\n');
}
)),
'',
'',
'</body>',
'</html>'
].join('\n');

View file

@ -1,6 +1,7 @@
// Template function for rendering the boilerplate html for cordova
import template from './template';
export default function({
// Template function for rendering the boilerplate html for cordova
export const headTemplate = ({
meteorRuntimeConfig,
rootUrlPathPrefix,
inlineScriptsAllowed,
@ -10,70 +11,62 @@ export default function({
htmlAttributes,
bundledJsCssUrlRewriteHook,
head,
body,
dynamicHead,
dynamicBody,
}) {
return [].concat(
[
'<html>',
'<head>',
' <meta charset="utf-8">',
' <meta name="format-detection" content="telephone=no">',
' <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">',
' <meta name="msapplication-tap-highlight" content="no">',
' <meta http-equiv="Content-Security-Policy" content="default-src * gap: data: blob: \'unsafe-inline\' \'unsafe-eval\' ws: wss:;">',
],
// We are explicitly not using bundledJsCssUrlRewriteHook: in cordova we serve assets up directly from disk, so rewriting the URL does not make sense
_.map(css, ({url}) =>
_.template(' <link rel="stylesheet" type="text/css" class="__meteor-css__" href="<%- href %>">')({
href: url
})
),
[
' <script type="text/javascript">',
_.template(' __meteor_runtime_config__ = JSON.parse(decodeURIComponent(<%= conf %>));')({
conf: meteorRuntimeConfig
}),
' if (/Android/i.test(navigator.userAgent)) {',
// When Android app is emulated, it cannot connect to localhost,
// instead it should connect to 10.0.2.2
// (unless we\'re using an http proxy; then it works!)
' if (!__meteor_runtime_config__.httpProxyPort) {',
' __meteor_runtime_config__.ROOT_URL = (__meteor_runtime_config__.ROOT_URL || \'\').replace(/localhost/i, \'10.0.2.2\');',
' __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = (__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL || \'\').replace(/localhost/i, \'10.0.2.2\');',
' }',
' }',
' </script>',
'',
' <script type="text/javascript" src="/cordova.js"></script>'
],
_.map(js, ({url}) =>
_.template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: url
})
),
}) => [
'<html>',
'<head>',
' <meta charset="utf-8">',
' <meta name="format-detection" content="telephone=no">',
' <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, viewport-fit=cover">',
' <meta name="msapplication-tap-highlight" content="no">',
' <meta http-equiv="Content-Security-Policy" content="default-src * gap: data: blob: \'unsafe-inline\' \'unsafe-eval\' ws: wss:;">',
_.map(additionalStaticJs, ({contents, pathname}) => (
(inlineScriptsAllowed
? _.template(' <script><%= contents %></script>')({
contents: contents
})
: _.template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: rootUrlPathPrefix + pathname
}))
)),
// We are explicitly not using bundledJsCssUrlRewriteHook: in cordova we serve assets up directly from disk, so rewriting the URL does not make sense
...(css || []).map(file =>
template(' <link rel="stylesheet" type="text/css" class="__meteor-css__" href="<%- href %>">')({
href: file.url,
})
),
[
'',
head,
'</head>',
'',
'<body>',
body,
'</body>',
'</html>'
],
).join('\n');
' <script type="text/javascript">',
template(' __meteor_runtime_config__ = JSON.parse(decodeURIComponent(<%= conf %>));')({
conf: meteorRuntimeConfig,
}),
' if (/Android/i.test(navigator.userAgent)) {',
// When Android app is emulated, it cannot connect to localhost,
// instead it should connect to 10.0.2.2
// (unless we\'re using an http proxy; then it works!)
' if (!__meteor_runtime_config__.httpProxyPort) {',
' __meteor_runtime_config__.ROOT_URL = (__meteor_runtime_config__.ROOT_URL || \'\').replace(/localhost/i, \'10.0.2.2\');',
' __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = (__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL || \'\').replace(/localhost/i, \'10.0.2.2\');',
' }',
' }',
' </script>',
'',
' <script type="text/javascript" src="/cordova.js"></script>',
...(js || []).map(file =>
template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: file.url,
})
),
...(additionalStaticJs || []).map(({ contents, pathname }) => (
inlineScriptsAllowed
? template(' <script><%= contents %></script>')({
contents,
})
: template(' <script type="text/javascript" src="<%- src %>"></script>')({
src: rootUrlPathPrefix + pathname
})
)),
'',
head,
'</head>',
'',
'<body>',
].join('\n');
export function closeTemplate() {
return "</body>\n</html>";
}

View file

@ -0,0 +1,14 @@
import { _ } from 'meteor/underscore';
// As identified in issue #9149, when an application overrides the default
// _.template settings using _.templateSettings, those new settings are
// used anywhere _.template is used, including within the
// boilerplate-generator. To handle this, _.template settings that have
// been verified to work are overridden here on each _.template call.
export default function template(text) {
return _.template(text, null, {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g,
});
};