From efea20feb54b1934507f9f78da4d5251b4b47982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 23 Sep 2016 11:16:26 +0200 Subject: [PATCH 01/28] Normalize line endings to support both LF and CRLF This should fix build failures on Windows caused by line-ending mismatch. --- test/executor.test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/executor.test.js b/test/executor.test.js index 3f98556..3a5e66c 100644 --- a/test/executor.test.js +++ b/test/executor.test.js @@ -804,10 +804,11 @@ describe('executor', function() { .get('/') .end(function(err, res) { if (err) return done(err); - expect(res.text).to.eql(('\n\n\n' + + var EXPECTED_TEXT = '\n\n\n' + ' \n simple-app\n' + '\n\n

simple-app

\n' + - '\n').replace(/\n/g, os.EOL)); + '\n'; + expect(normalizeEols(res.text)).to.eql(normalizeEols(EXPECTED_TEXT)); done(); }); }); @@ -1129,3 +1130,7 @@ function envAppInstructions() { env: 'test', }); } + +function normalizeEols(str) { + return str.replace(/\r\n/g, '\n'); +} From d2d9e8789e3ce6525fcaf97f4573947293b23121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 12 Oct 2016 14:36:34 +0200 Subject: [PATCH 02/28] Fix resolution of middleware modules Fix the code loading "loopback#errorhandler" (for example) to correctly look up the "loopback" module in node_modules of the bootstrapped application, instead of looking it up in node_modules of loopback-boot. --- lib/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 7258e6a..614d76e 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -569,7 +569,7 @@ function resolveMiddlewarePath(rootDir, middleware, config) { // Try to require the module and check if . is a valid // function - var m = require(pathName); + var m = require(sourceFile); if (typeof m[fragment] === 'function') { resolved.sourceFile = sourceFile; return resolved; From 9cb3d0648b7d39e17e1e3e47ff26a098c44a3754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 13 Oct 2016 10:15:17 +0200 Subject: [PATCH 03/28] 2.23.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix resolution of middleware modules (Miroslav Bajtoš) * Normalize line endings to support both LF and CRLF (Miroslav Bajtoš) --- CHANGES.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a386697..ec0e574 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,11 @@ +2016-10-13, Version 2.23.0 +========================== + + * Fix resolution of middleware modules (Miroslav Bajtoš) + + * Normalize line endings to support both LF and CRLF (Miroslav Bajtoš) + + 2016-09-05, Version 2.22.0 ========================== diff --git a/package.json b/package.json index ede2e8e..f4b3d67 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.22.0", + "version": "2.23.0", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From 49016b4e66d9dadc2554dec8b346ad91f7481c1e Mon Sep 17 00:00:00 2001 From: Benjamin Kroeger Date: Tue, 29 Nov 2016 10:57:42 +0100 Subject: [PATCH 04/28] add support for absolute middleware paths on win32 uses simple regex check to test if a path matches NTFS notation --- lib/compiler.js | 5 ++++- test/compiler.test.js | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 614d76e..7175db3 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -381,7 +381,10 @@ function tryResolveAppPath(rootDir, relativePath, resolveOptions) { resolveOptions = resolveOptions || { strict: true }; var isModuleRelative = false; - if (relativePath[0] === '/') { + // would love to use `path.isAbsolute(relativePath)` from node's core module `path` + // but unfortunately that is not available in node v0.10.x + // https://nodejs.org/dist/latest-v6.x/docs/api/path.html#path_path_isabsolute_path + if (relativePath[0] === '/' || /^[a-zA-Z]:[\\]{1,2}/.test(relativePath)) { fullPath = relativePath; } else if (start === './' || start === '..') { fullPath = path.resolve(rootDir, relativePath); diff --git a/test/compiler.test.js b/test/compiler.test.js index 41b28c9..a93d776 100644 --- a/test/compiler.test.js +++ b/test/compiler.test.js @@ -2016,6 +2016,22 @@ describe('compiler', function() { .to.equal(require.resolve('loopback/server/middleware/url-not-found')); }); + it('supports absolute paths notation', function() { + var middlewarePath = + path.resolve(__dirname, './fixtures/simple-middleware.js'); + var routes = {}; + routes[middlewarePath] = {}; + appdir.writeConfigFileSync('middleware.json', { + 'routes': routes, + }); + + var instructions = boot.compile(appdir.PATH); + + expect(instructions.middleware.middleware[0].sourceFile) + .to.equal(path.resolve(appdir.PATH, + middlewarePath)); + }); + it('supports shorthand notation for relative paths', function() { appdir.writeConfigFileSync('middleware.json', { 'routes': { From 67c4f1e1a3c32870f72bb9140069eced263b6901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 24 Mar 2017 12:04:25 +0100 Subject: [PATCH 05/28] Fix browser tests on Node.js 0.10 --- test/helpers/browser.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/helpers/browser.js b/test/helpers/browser.js index 8b6f03d..5580e0f 100644 --- a/test/helpers/browser.js +++ b/test/helpers/browser.js @@ -63,6 +63,12 @@ function createContext() { // `window` is used by loopback to detect browser runtime context.window = context; + // In Node.js 0.10, the Uint8Array is provided by Node.js glue, + // it's not available in the V8 runtime itself + if (/^v0\.10/.test(process.version)) { + context.Uint8Array = Uint8Array; + } + return vm.createContext(context); } exports.createContext = createContext; From 95e5201255449efbb17c1feb1580056efcc76eb1 Mon Sep 17 00:00:00 2001 From: Supasate Choochaisri Date: Fri, 24 Mar 2017 01:13:37 +0700 Subject: [PATCH 06/28] Provide options.scriptExtensions --- lib/compiler.js | 102 ++++++++++-------- test/executor.test.js | 17 +++ test/fixtures/simple-app/boot/custom.customjs | 6 ++ .../fixtures/simple-app/boot/custom.customjs2 | 6 ++ 4 files changed, 88 insertions(+), 43 deletions(-) create mode 100644 test/fixtures/simple-app/boot/custom.customjs create mode 100644 test/fixtures/simple-app/boot/custom.customjs2 diff --git a/lib/compiler.js b/lib/compiler.js index 614d76e..8fe1e4b 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -17,6 +17,13 @@ var g = require('strong-globalize')(); var FILE_EXTENSION_JSON = '.json'; +function arrayToObject(array) { + return array.reduce(function(obj, val) { + obj[val] = val; + return obj; + }, {}); +} + /** * Gather all bootstrap-related configuration data and compile it into * a single object containing instruction for `boot.execute`. @@ -36,8 +43,14 @@ module.exports = function compile(options) { options = { appRootDir: options }; } + // For setting properties without modifying the original object + options = Object.create(options); + var appRootDir = options.appRootDir = options.appRootDir || process.cwd(); var env = options.env || process.env.NODE_ENV || 'development'; + var scriptExtensions = options.scriptExtensions ? + arrayToObject(options.scriptExtensions) : + require.extensions; var appConfigRootDir = options.appConfigRootDir || appRootDir; var appConfig = options.config || @@ -76,9 +89,9 @@ module.exports = function compile(options) { resolveRelativePaths(bootScripts, appRootDir); bootDirs.forEach(function(dir) { - bootScripts = bootScripts.concat(findScripts(dir)); + bootScripts = bootScripts.concat(findScripts(dir, scriptExtensions)); var envdir = dir + '/' + env; - bootScripts = bootScripts.concat(findScripts(envdir)); + bootScripts = bootScripts.concat(findScripts(envdir, scriptExtensions)); }); // de-dedup boot scripts -ERS @@ -90,12 +103,12 @@ module.exports = function compile(options) { var modelSources = options.modelSources || modelsMeta.sources || ['./models']; var modelInstructions = buildAllModelInstructions( - modelsRootDir, modelsConfig, modelSources, options.modelDefinitions); + modelsRootDir, modelsConfig, modelSources, options.modelDefinitions, + scriptExtensions); - var mixinDirs = options.mixinDirs || []; var mixinSources = options.mixinSources || modelsMeta.mixins || ['./mixins']; var mixinInstructions = buildAllMixinInstructions( - appRootDir, mixinDirs, mixinSources, options, modelInstructions); + appRootDir, options, mixinSources, scriptExtensions, modelInstructions); // When executor passes the instruction to loopback methods, // loopback modifies the data. Since we are loading the data using `require`, @@ -151,11 +164,11 @@ function assertIsValidModelConfig(config) { * @private */ -function findScripts(dir, extensions) { +function findScripts(dir, scriptExtensions) { assert(dir, g.f('cannot require directory contents without directory name')); var files = tryReadDir(dir); - extensions = extensions || _.keys(require.extensions); + scriptExtensions = scriptExtensions || require.extensions; // sort files in lowercase alpha for linux files.sort(function(a, b) { @@ -181,9 +194,9 @@ function findScripts(dir, extensions) { var filepath = path.resolve(path.join(dir, filename)); var stats = fs.statSync(filepath); - // only require files supported by require.extensions (.txt .md etc.) + // only require files supported by specified extensions if (stats.isFile()) { - if (isPreferredExtension(filename)) + if (scriptExtensions && isPreferredExtension(filename, scriptExtensions)) results.push(filepath); else debug('Skipping file %s - unknown extension', filepath); @@ -204,9 +217,12 @@ function tryReadDir() { } function buildAllModelInstructions(rootDir, modelsConfig, sources, - modelDefinitions) { - var registry = verifyModelDefinitions(rootDir, modelDefinitions) || - findModelDefinitions(rootDir, sources); + modelDefinitions, scriptExtensions) { + var registry = verifyModelDefinitions(rootDir, modelDefinitions, + scriptExtensions); + if (!registry) { + registry = findModelDefinitions(rootDir, sources, scriptExtensions); + } var modelNamesToBuild = addAllBaseModels(registry, Object.keys(modelsConfig)); @@ -287,7 +303,7 @@ function sortByInheritance(instructions) { }); } -function verifyModelDefinitions(rootDir, modelDefinitions) { +function verifyModelDefinitions(rootDir, modelDefinitions, scriptExtensions) { if (!modelDefinitions || modelDefinitions.length < 1) { return undefined; } @@ -299,7 +315,7 @@ function verifyModelDefinitions(rootDir, modelDefinitions) { definition.sourceFile = fixFileExtension( fullPath, tryReadDir(path.dirname(fullPath)), - true); + scriptExtensions); if (!definition.sourceFile) { debug('Model source code not found: %s - %s', definition.sourceFile); } @@ -325,7 +341,7 @@ function verifyModelDefinitions(rootDir, modelDefinitions) { return registry; } -function findModelDefinitions(rootDir, sources) { +function findModelDefinitions(rootDir, sources, scriptExtensions) { var registry = {}; sources.forEach(function(src) { @@ -343,7 +359,8 @@ function findModelDefinitions(rootDir, sources) { }) .forEach(function(f) { var fullPath = path.resolve(srcDir, f); - var entry = loadModelDefinition(rootDir, fullPath, files); + var entry = loadModelDefinition(rootDir, fullPath, files, + scriptExtensions); var modelName = entry.definition.name; if (!modelName) { debug('Skipping model definition without Model name: %s', @@ -445,13 +462,13 @@ function tryResolveAppPath(rootDir, relativePath, resolveOptions) { return undefined; } -function loadModelDefinition(rootDir, jsonFile, allFiles) { +function loadModelDefinition(rootDir, jsonFile, allFiles, scriptExtensions) { var definition = require(jsonFile); var basename = path.basename(jsonFile, path.extname(jsonFile)); definition.name = definition.name || _.capitalize(_.camelCase(basename)); // find a matching file with a supported extension like `.js` or `.coffee` - var sourceFile = fixFileExtension(jsonFile, allFiles, true); + var sourceFile = fixFileExtension(jsonFile, allFiles, scriptExtensions); if (sourceFile === undefined) { debug('Model source code not found: %s', sourceFile); @@ -644,19 +661,21 @@ function getExcludedExtensions() { }; } -function isPreferredExtension(filename) { - var includeExtensions = require.extensions; +function isPreferredExtension(filename, includeExtensions) { + assert(!!includeExtensions, '"includeExtensions" argument is required'); var ext = path.extname(filename); return (ext in includeExtensions) && !(ext in getExcludedExtensions()); } -function fixFileExtension(filepath, files, onlyScriptsExportingFunction) { +function fixFileExtension(filepath, files, scriptExtensions) { var results = []; var otherFile; /* Prefer coffee scripts over json */ - if (isPreferredExtension(filepath)) return filepath; + if (scriptExtensions && isPreferredExtension(filepath, scriptExtensions)) { + return filepath; + } var basename = path.basename(filepath, FILE_EXTENSION_JSON); var sourceDir = path.dirname(filepath); @@ -670,10 +689,7 @@ function fixFileExtension(filepath, files, onlyScriptsExportingFunction) { if (!(otherFileExtension in getExcludedExtensions()) && path.basename(f, otherFileExtension) == basename) { - if (!onlyScriptsExportingFunction) - results.push(otherFile); - else if (onlyScriptsExportingFunction && - (typeof require.extensions[otherFileExtension]) === 'function') { + if (!scriptExtensions || otherFileExtension in scriptExtensions) { results.push(otherFile); } } @@ -689,32 +705,33 @@ function resolveAppScriptPath(rootDir, relativePath, resolveOptions) { } var sourceDir = path.dirname(resolvedPath); var files = tryReadDir(sourceDir); - var fixedFile = fixFileExtension(resolvedPath, files, false); + var fixedFile = fixFileExtension(resolvedPath, files); return (fixedFile === undefined ? resolvedPath : fixedFile); } -function buildAllMixinInstructions(appRootDir, mixinDirs, mixinSources, options, - modelInstructions) { - var extensions = _.without(_.keys(require.extensions), - _.keys(getExcludedExtensions())); - +function buildAllMixinInstructions(appRootDir, options, mixinSources, + scriptExtensions, modelInstructions) { // load mixins from `options.mixins` var sourceFiles = options.mixins || []; - var instructionsFromMixins = loadMixins(sourceFiles, options); + var mixinDirs = options.mixinDirs || []; + var instructionsFromMixins = loadMixins(sourceFiles, options.normalization); // load mixins from `options.mixinDirs` - sourceFiles = findMixinDefinitions(appRootDir, mixinDirs, extensions); + sourceFiles = findMixinDefinitions(appRootDir, mixinDirs, scriptExtensions); if (sourceFiles === undefined) return; - var instructionsFromMixinDirs = loadMixins(sourceFiles, options); + var instructionsFromMixinDirs = loadMixins(sourceFiles, + options.normalization); /* If `mixinDirs` and `mixinSources` have any directories in common, * then remove the common directories from `mixinSources` */ mixinSources = _.difference(mixinSources, mixinDirs); // load mixins from `options.mixinSources` - sourceFiles = findMixinDefinitions(appRootDir, mixinSources, extensions); + sourceFiles = findMixinDefinitions(appRootDir, mixinSources, + scriptExtensions); if (sourceFiles === undefined) return; - var instructionsFromMixinSources = loadMixins(sourceFiles, options); + var instructionsFromMixinSources = loadMixins(sourceFiles, + options.normalization); // Fetch unique list of mixin names, used in models var modelMixins = fetchMixinNamesUsedInModelInstructions(modelInstructions); @@ -732,7 +749,7 @@ function buildAllMixinInstructions(appRootDir, mixinDirs, mixinSources, options, return _.values(mixins); } -function findMixinDefinitions(appRootDir, sourceDirs, extensions) { +function findMixinDefinitions(appRootDir, sourceDirs, scriptExtensions) { var files = []; sourceDirs.forEach(function(dir) { var path = tryResolveAppPath(appRootDir, dir); @@ -740,12 +757,12 @@ function findMixinDefinitions(appRootDir, sourceDirs, extensions) { debug('Skipping unknown module source dir %j', dir); return; } - files = files.concat(findScripts(path, extensions)); + files = files.concat(findScripts(path, scriptExtensions)); }); return files; } -function loadMixins(sourceFiles, options) { +function loadMixins(sourceFiles, normalization) { var mixinInstructions = {}; sourceFiles.forEach(function(filepath) { var dir = path.dirname(filepath); @@ -753,7 +770,7 @@ function loadMixins(sourceFiles, options) { var name = path.basename(filepath, ext); var metafile = path.join(dir, name + FILE_EXTENSION_JSON); - name = normalizeMixinName(name, options); + name = normalizeMixinName(name, normalization); var meta = {}; meta.name = name; if (utils.fileExistsSync(metafile)) { @@ -788,8 +805,7 @@ function filterMixinInstructionsUsingWhitelist(instructions, includeMixins) { return filteredInstructions; } -function normalizeMixinName(str, options) { - var normalization = options.normalization; +function normalizeMixinName(str, normalization) { switch (normalization) { case false: case 'none': return str; diff --git a/test/executor.test.js b/test/executor.test.js index 3a5e66c..7d00b10 100644 --- a/test/executor.test.js +++ b/test/executor.test.js @@ -299,6 +299,23 @@ describe('executor', function() { }); }); + it('searches boot file extensions specified in options.scriptExtensions', + function(done) { + var options = { + app: app, + appRootDir: path.join(__dirname, './fixtures/simple-app'), + scriptExtensions: ['.customjs', '.customjs2'], + }; + boot.execute(app, boot.compile(options), function(err) { + if (err) return done(err); + expect(process.bootFlags, 'process: bootFlags').to.eql([ + 'customjs', + 'customjs2', + ]); + done(); + }); + }); + describe('for mixins', function() { var options; beforeEach(function() { diff --git a/test/fixtures/simple-app/boot/custom.customjs b/test/fixtures/simple-app/boot/custom.customjs new file mode 100644 index 0000000..8fde947 --- /dev/null +++ b/test/fixtures/simple-app/boot/custom.customjs @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function(app, callback) { + process.bootFlags.push('customjs'); + callback(); +}; diff --git a/test/fixtures/simple-app/boot/custom.customjs2 b/test/fixtures/simple-app/boot/custom.customjs2 new file mode 100644 index 0000000..14a5de2 --- /dev/null +++ b/test/fixtures/simple-app/boot/custom.customjs2 @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function(app, callback) { + process.bootFlags.push('customjs2'); + callback(); +}; From 7f14a24ed289d3385652ecd4d4f59a633788901f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 3 Apr 2017 15:14:51 +0200 Subject: [PATCH 07/28] 2.24.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Provide options.scriptExtensions (Supasate Choochaisri) * Fix browser tests on Node.js 0.10 (Miroslav Bajtoš) --- CHANGES.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index ec0e574..b8cdb07 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,11 @@ +2017-04-03, Version 2.24.0 +========================== + + * Provide options.scriptExtensions (Supasate Choochaisri) + + * Fix browser tests on Node.js 0.10 (Miroslav Bajtoš) + + 2016-10-13, Version 2.23.0 ========================== diff --git a/package.json b/package.json index f4b3d67..854c1e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.23.0", + "version": "2.24.0", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From e5224368d4dc483899a2c97e456c2a031fa8ed13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 7 Jun 2017 14:08:51 +0200 Subject: [PATCH 08/28] 2.24.1 * add support for absolute middleware paths on win32 (Benjamin Kroeger) --- CHANGES.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index b8cdb07..99ee7ce 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +2017-06-07, Version 2.24.1 +========================== + + * add support for absolute middleware paths on win32 (Benjamin Kroeger) + + 2017-04-03, Version 2.24.0 ========================== diff --git a/package.json b/package.json index 854c1e6..98d86f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.24.0", + "version": "2.24.1", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From b607f969b873711be63ea1d16034c10be09ff63c Mon Sep 17 00:00:00 2001 From: Allen Boone Date: Tue, 23 May 2017 14:26:35 -0400 Subject: [PATCH 09/28] Update translated strings Q2 2017 --- intl/de/messages.json | 17 +++++++++++++++++ intl/es/messages.json | 17 +++++++++++++++++ intl/fr/messages.json | 17 +++++++++++++++++ intl/it/messages.json | 17 +++++++++++++++++ intl/ja/messages.json | 17 +++++++++++++++++ intl/ko/messages.json | 17 +++++++++++++++++ intl/nl/messages.json | 17 +++++++++++++++++ intl/pt/messages.json | 17 +++++++++++++++++ intl/tr/messages.json | 17 +++++++++++++++++ intl/zh-Hans/messages.json | 17 +++++++++++++++++ intl/zh-Hant/messages.json | 17 +++++++++++++++++ 11 files changed, 187 insertions(+) create mode 100644 intl/de/messages.json create mode 100644 intl/es/messages.json create mode 100644 intl/fr/messages.json create mode 100644 intl/it/messages.json create mode 100644 intl/ja/messages.json create mode 100644 intl/ko/messages.json create mode 100644 intl/nl/messages.json create mode 100644 intl/pt/messages.json create mode 100644 intl/tr/messages.json create mode 100644 intl/zh-Hans/messages.json create mode 100644 intl/zh-Hant/messages.json diff --git a/intl/de/messages.json b/intl/de/messages.json new file mode 100644 index 0000000..e6c2a44 --- /dev/null +++ b/intl/de/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "Pfad \"{0}\" kann nicht aufgelöst werden", + "34319676975b1abf107da7a056abb434": "Ungültiges Normalisierungsformat - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "Die `app` wird von einer nicht kompatiblen Loopback-Version {0} betrieben. Unterstützte Versionen: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "WARNUNG: Hauptkonfigurationsdatei \"{0}{{.json}}\" fehlt", + "4d052d84c8620730afd4a30832f11724": "Unbekanntes Modell {0} kann nicht konfiguriert werden", + "4ed668e9187650d898acf97707df445a": "Die {{phase}} \"{0}\" ist in der Hauptkonfiguration nicht definiert.", + "6447e6b342a2c51ab0bc53b3cbdf3742": "Sortierungskonflikt: \"{0}\" kann nicht nach \"{1}\" hinzugefügt werden, da die entgegengesetzte Reihenfolge bereits angegeben wurde", + "70654dc6eb565613a33344efed3de998": "Laden von Boot-Script fehlgeschlagen: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} wird nicht in einen gültigen Wert aufgelöst; zurückgegeben als {1}. \"{2}\" muss in der Umgebungsvariable oder über {{app.get()}} auflösbar sein.", + "91a742b7c3568cf6b6755741a70b3c52": "Die {{middleware}} \"{0}\" in {{phase}} \"{1}\" ist in der Hauptkonfiguration nicht definiert.", + "a3aa22086ae4976cd013065c9a3ff81c": "{0} kann nicht angewendet werden: ", + "be2cf2868ba54624fe38e9908dde5e9e": "Die Daten in {{model-config.json}} haben das nicht unterstützte {{1.x}}-Format.", + "ec551b6f2fafd8d40af801ebe5bb09f6": "{{middleware}}-Anweisungen werden verworfen, {{loopback}}-Client unterstützt {{middleware}} nicht.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" nicht gefunden: {1}" +} + diff --git a/intl/es/messages.json b/intl/es/messages.json new file mode 100644 index 0000000..5a0bee3 --- /dev/null +++ b/intl/es/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "No se puede resolver la vía de acceso \"{0}\"", + "34319676975b1abf107da7a056abb434": "Formato de normalización no válido - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "La `app` está basada en una versión de loopback incompatible {0}. Versiones soportadas: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "AVISO: falta el archivo de configuración principal \"{0}{{.json}}\"", + "4d052d84c8620730afd4a30832f11724": "No se puede configurar el modelo desconocido {0}", + "4ed668e9187650d898acf97707df445a": "La {{phase}} \"{0}\" no está definida en la configuración principal.", + "6447e6b342a2c51ab0bc53b3cbdf3742": "Conflicto de orden: no se puede añadir \"{0}\" después de \"{1}\", porque ya se ha especificado el orden inverso.", + "70654dc6eb565613a33344efed3de998": "No se ha podido cargar el script de arranque: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} no se resuelve como un valor válido, se ha devuelto como {1}. \"{2}\" debe poder resolverse en la variable de entorno o por medio de {{app.get()}}.", + "91a742b7c3568cf6b6755741a70b3c52": "El {{middleware}} \"{0}\" en la {{phase}} \"{1}\" no está definido en la configuración principal.", + "a3aa22086ae4976cd013065c9a3ff81c": "No se puede aplicar {0}: ", + "be2cf2868ba54624fe38e9908dde5e9e": "Los datos de {{model-config.json}} están en un formato {{1.x}} no soportado.", + "ec551b6f2fafd8d40af801ebe5bb09f6": "Descartando instrucciones de {{middleware}}, el cliente de {{loopback}} no da soporte a {{middleware}}.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" no encontrado: {1}" +} + diff --git a/intl/fr/messages.json b/intl/fr/messages.json new file mode 100644 index 0000000..259d6f8 --- /dev/null +++ b/intl/fr/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "Impossible de résoudre le chemin \"{0}\"", + "34319676975b1abf107da7a056abb434": "Format de normalisation non valide - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "L'application `app` est basée sur une version loopback {0} incompatible. Versions prises en charge : {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "AVERTISSEMENT : le fichier de configuration principal \"{0}{{.json}}\" est manquant", + "4d052d84c8620730afd4a30832f11724": "Impossible de configurer le modèle inconnu {0}", + "4ed668e9187650d898acf97707df445a": "{{phase}} \"{0}\" n'est pas défini dans la configuration principale.", + "6447e6b342a2c51ab0bc53b3cbdf3742": "Conflit concernant l'ordre : impossible d'ajouter \"{0}\" après \"{1}\" car l'ordre opposé à déjà été spécifié", + "70654dc6eb565613a33344efed3de998": "Echec du chargement du script d'amorçage : {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} n'est pas résolu en une valeur valide, renvoyé sous forme de {1}. \"{2}\" doit pouvoir être résolu dans la variable d'environnement ou par {{app.get()}}.", + "91a742b7c3568cf6b6755741a70b3c52": "Le {{middleware}} \"{0}\" dans {{phase}} \"{1}\" n'est pas défini dans la configuration principale.", + "a3aa22086ae4976cd013065c9a3ff81c": "Impossible d'appliquer {0} : ", + "be2cf2868ba54624fe38e9908dde5e9e": "Les données contenues dans {{model-config.json}} sont au format {{1.x}} qui n'est pas pris en charge.", + "ec551b6f2fafd8d40af801ebe5bb09f6": "Les instructions {{middleware}} sont ignorées ; le client {{loopback}} ne prend pas en charge {{middleware}}.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" introuvable : {1}" +} + diff --git a/intl/it/messages.json b/intl/it/messages.json new file mode 100644 index 0000000..c1c5ffd --- /dev/null +++ b/intl/it/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "Impossibile risolvere il percorso \"{0}\"", + "34319676975b1abf107da7a056abb434": "Formato di normalizzazione non valido - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "The `app` is powered by an incompatible loopback version {0}. Versioni supportate: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "WARNING: Main config file \"{0}{{.json}}\" is missing", + "4d052d84c8620730afd4a30832f11724": "Impossibile configurare il modello {0} sconosciuto", + "4ed668e9187650d898acf97707df445a": "{{phase}} \"{0}\" non definita nella configurazione principale.", + "6447e6b342a2c51ab0bc53b3cbdf3742": "Conflitto di ordinamento: impossibile aggiungere \"{0}\" dopo \"{1}\", perché è già stato specificato l'ordine opposto", + "70654dc6eb565613a33344efed3de998": "Caricamento dello script di boot non riuscito: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} non viene risolto in un valore valido, restituito come {1}. \"{2}\" must be resolvable in Environment variable or by {{app.get()}}.", + "91a742b7c3568cf6b6755741a70b3c52": "The {{middleware}} \"{0}\" in {{phase}} \"{1}\"is not defined in the main config.", + "a3aa22086ae4976cd013065c9a3ff81c": "Cannot apply {0}: ", + "be2cf2868ba54624fe38e9908dde5e9e": "The data in {{model-config.json}} is in the unsupported {{1.x}} format.", + "ec551b6f2fafd8d40af801ebe5bb09f6": "Eliminazione delle istruzioni {{middleware}}, il client {{loopback}} non supporta {{middleware}}.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" not found: {1}" +} + diff --git a/intl/ja/messages.json b/intl/ja/messages.json new file mode 100644 index 0000000..930bf80 --- /dev/null +++ b/intl/ja/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "パス \"{0}\" を解決できません", + "34319676975b1abf107da7a056abb434": "無効な正規化形式 - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "「アプリケーション」は、互換性のない loopback バージョン {0} を使用しています。サポートされるバージョン: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "警告: メイン構成ファイル \"{0}{{.json}}\" が欠落しています", + "4d052d84c8620730afd4a30832f11724": "不明なモデル {0} を構成できません", + "4ed668e9187650d898acf97707df445a": "メイン構成内に {{phase}} \"{0}\" が定義されていません。", + "6447e6b342a2c51ab0bc53b3cbdf3742": "順序付けの競合: \"{0}\" を \"{1}\" の後に追加することはできません。既に逆の順序が指定されています", + "70654dc6eb565613a33344efed3de998": "ブート・スクリプトのロードに失敗しました: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} は有効な値に解決されず、{1} として返されました。 \"{2}\" は環境変数または {{app.get()}} で解決できなければなりません。", + "91a742b7c3568cf6b6755741a70b3c52": "{{phase}} \"{1}\" の {{middleware}} \"{0}\" がメイン構成内に定義されていません。", + "a3aa22086ae4976cd013065c9a3ff81c": "{0} を適用できません: ", + "be2cf2868ba54624fe38e9908dde5e9e": "{{model-config.json}} のデータが、サポートされていない {{1.x}} 形式になっています。", + "ec551b6f2fafd8d40af801ebe5bb09f6": "{{middleware}} 命令を破棄します。{{loopback}} クライアントでは {{middleware}} はサポートされません。", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "ミドルウェア \"{0}\" が見つかりません: {1}" +} + diff --git a/intl/ko/messages.json b/intl/ko/messages.json new file mode 100644 index 0000000..83de953 --- /dev/null +++ b/intl/ko/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "\"{0}\" 경로를 해석할 수 없음", + "34319676975b1abf107da7a056abb434": "올바르지 않은 정규화 형식 - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "`앱`이 호환되지 않는 루프백 버전 {0}을(를) 기반으로 합니다. 지원되는 버전: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "경고: 기본 구성 파일 \"{0}{{.json}}\"이(가) 누락됨", + "4d052d84c8620730afd4a30832f11724": "알 수 없는 모델 {0}을(를) 구성할 수 없음", + "4ed668e9187650d898acf97707df445a": "{{phase}} \"{0}\"이(가) 기본 구성에 정의되어 있지 않습니다.", + "6447e6b342a2c51ab0bc53b3cbdf3742": "순서 지정 충돌: 반대 순서로 이미 지정되어서 \"{1}\" 뒤에 \"{0}\"을(를) 추가할 수 없음", + "70654dc6eb565613a33344efed3de998": "부트 스크립트를 로드하는 데 실패함: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0}이(가) 올바른 값으로 해석되지 않아서 {1}(으)로 리턴되었습니다. \"{2}\"은(는) 환경 변수에서 또는 {{app.get()}}에 의해 해석 가능해야 합니다. ", + "91a742b7c3568cf6b6755741a70b3c52": "{{phase}} \"{1}\"의 {{middleware}} \"{0}\"이(가) 기본 구성에 정의되어 있지 않습니다. ", + "a3aa22086ae4976cd013065c9a3ff81c": "{0}을(를) 적용할 수 없음: ", + "be2cf2868ba54624fe38e9908dde5e9e": "{{model-config.json}}의 데이터가 지원되지 않는 {{1.x}} 형식입니다. ", + "ec551b6f2fafd8d40af801ebe5bb09f6": "{{middleware}} 지시사항을 버리십시오. {{loopback}} 클라이언트가 {{middleware}}을(를) 지원하지 않습니다.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "미들웨어 \"{0}\"을(를) 찾을 수 없음: {1}" +} + diff --git a/intl/nl/messages.json b/intl/nl/messages.json new file mode 100644 index 0000000..8be774c --- /dev/null +++ b/intl/nl/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "Pad \"{0}\" kan niet worden omgezet.", + "34319676975b1abf107da7a056abb434": "Ongeldige normalisatie-indeling - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "De 'app' wordt aangestuurd door een incompatibele versie van loopback, {0}. Ondersteunde versies: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "WAARSCHUWING: Hoofdconfiguratiebestand \"{0}{{.json}}\" ontbreekt.", + "4d052d84c8620730afd4a30832f11724": "Configuratie van onbekend model {0} kan niet ongedaan worden gemaakt", + "4ed668e9187650d898acf97707df445a": "De {{phase}} \"{0}\" is niet gedefinieerd in de hoofdconfiguratie.", + "6447e6b342a2c51ab0bc53b3cbdf3742": "Volgordeconflict: \"{0}\" kan niet worden toegevoegd na \"{1}\", omdat de omgekeerde volgorde al is opgegeven.", + "70654dc6eb565613a33344efed3de998": "Laden van opstartscript is mislukt: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} wordt niet omgezet in een geldige waarde; wordt geretourneerd als {1}. \"{2}\" moet omgezet kunnen worden in een omgevingsvariabele of door {{app.get()}}.", + "91a742b7c3568cf6b6755741a70b3c52": "De {{middleware}} \"{0}\" in {{phase}} \"{1}\" is niet gedefinieerd in de hoofdconfiguratie.", + "a3aa22086ae4976cd013065c9a3ff81c": "{0} kan niet worden toegepast: ", + "be2cf2868ba54624fe38e9908dde5e9e": "De gegevens in {{model-config.json}} hebben de niet ondersteunde indeling {{1.x}}.", + "ec551b6f2fafd8d40af801ebe5bb09f6": "{{middleware}} instructies worden verwijderd, {{loopback}}-client ondersteunt geen {{middleware}}.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" is niet gevonden: {1}" +} + diff --git a/intl/pt/messages.json b/intl/pt/messages.json new file mode 100644 index 0000000..2a98bbb --- /dev/null +++ b/intl/pt/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "Não é possível resolver caminho \"{0}\"", + "34319676975b1abf107da7a056abb434": "Formato de normalização inválido - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "O `app` é desenvolvido com uma versão de loopback incompatível {0}. Versões suportadas: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "AVISO: o arquivo de configuração principal \"{0}{{.json}}\" está ausente", + "4d052d84c8620730afd4a30832f11724": "Não é possível configurar modelo desconhecido {0}", + "4ed668e9187650d898acf97707df445a": "A {{phase}} \"{0}\" não foi definida na configuração principal.", + "6447e6b342a2c51ab0bc53b3cbdf3742": "Conflito de ordem: não é possível incluir \"{0}\" após \"{1}\", porque a ordem oposta já foi especificada", + "70654dc6eb565613a33344efed3de998": "Falha ao carregar script de inicialização: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} não resolve para um valor válido, retornado como {1}. \"{2}\" deve ser resolvível na variável de ambiente ou pelo {{app.get()}}.", + "91a742b7c3568cf6b6755741a70b3c52": "O {{middleware}} \"{0}\" em {{phase}} \"{1}\" não é definido na configuração principal.", + "a3aa22086ae4976cd013065c9a3ff81c": "Não é possível aplicar {0}: ", + "be2cf2868ba54624fe38e9908dde5e9e": "Os dados em {{model-config.json}} estão no formato não suportado {{1.x}}.", + "ec551b6f2fafd8d40af801ebe5bb09f6": "Descartando instruções de {{middleware}}, cliente de {{loopback}} não suporta {{middleware}}.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" não localizado: {1}" +} + diff --git a/intl/tr/messages.json b/intl/tr/messages.json new file mode 100644 index 0000000..574cc81 --- /dev/null +++ b/intl/tr/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "\"{0}\" yolu çözülemiyor", + "34319676975b1abf107da7a056abb434": "Geçersiz normalleştirme biçimi - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "`app` uyumsuz olan geri döngü {0} sürümüyle güçlendirilmiş. Desteklenen sürümler: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "UYARI: Ana yapılandırma dosyası \"{0}{{.json}}\" eksik", + "4d052d84c8620730afd4a30832f11724": "Bilinmeyen {0} modeli yapılandırılamıyor", + "4ed668e9187650d898acf97707df445a": "{{phase}} \"{0}\", ana yapılandırmada tanımlı değil", + "6447e6b342a2c51ab0bc53b3cbdf3742": "Sıralama çakışması: \"{0}\", \"{1}\" sonrasına eklenemez; karşıt sıra belirtilmiş", + "70654dc6eb565613a33344efed3de998": "Önyükleme komut dosyasının yüklenmesi başarısız oldu: {0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} geçerli bir değere çözülmüyor, {1} olarak döndürüldü. \"{2}\" ortam değişkeninde ya da {{app.get()}} ile çözülebilir olmalıdır.", + "91a742b7c3568cf6b6755741a70b3c52": "{{phase}} \"{1}\" aşamasındaki {{middleware}} \"{0}\" ana yapılandırmada tanımlı değil.", + "a3aa22086ae4976cd013065c9a3ff81c": "{0} uygulanamıyor: ", + "be2cf2868ba54624fe38e9908dde5e9e": "{{model-config.json}} içindeki verileri desteklenmeyen {{1.x}} biçiminde.", + "ec551b6f2fafd8d40af801ebe5bb09f6": "{{middleware}} yönergeleri atılıyor, {{middleware}}, {{loopback}} istemcisi tarafından desteklenmiyor.", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Ara katman \"{0}\" bulunamadı: {1}" +} + diff --git a/intl/zh-Hans/messages.json b/intl/zh-Hans/messages.json new file mode 100644 index 0000000..9b0fcc1 --- /dev/null +++ b/intl/zh-Hans/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "无法解析路径“{0}”", + "34319676975b1abf107da7a056abb434": "标准化格式无效 -“{0}”", + "3a7049e42006e8bc19e0f4fc8df63b6b": "应用程序由不兼容的回环版本 {0} 支持。受支持的版本:{1}", + "3f93b626dd9a1c33d67490f6e71018b5": "警告:缺失主要配置文件“{0}{{.json}}”", + "4d052d84c8620730afd4a30832f11724": "无法配置未知的模型 {0}", + "4ed668e9187650d898acf97707df445a": "未在主配置中定义 {{phase}}“{0}”。", + "6447e6b342a2c51ab0bc53b3cbdf3742": "顺序冲突:不能在“{1}”之后添加“{0}”,因为已指定相反顺序", + "70654dc6eb565613a33344efed3de998": "无法装入引导脚本:{0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} 未解析为有效值,返回为 {1}。“{2}”必须可在环境变量中解析或由 {{app.get()}} 解析。", + "91a742b7c3568cf6b6755741a70b3c52": "未在主配置中定义 {{phase}}“{1}”中的 {{middleware}}“{0}”。", + "a3aa22086ae4976cd013065c9a3ff81c": "无法应用 {0}:", + "be2cf2868ba54624fe38e9908dde5e9e": "{{model-config.json}} 中的数据不是受支持的 {{1.x}} 格式。", + "ec551b6f2fafd8d40af801ebe5bb09f6": "正在丢弃 {{middleware}} 指示信息,{{loopback}} 客户机不支持 {{middleware}}。", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "找不到中间件“{0}”:{1}" +} + diff --git a/intl/zh-Hant/messages.json b/intl/zh-Hant/messages.json new file mode 100644 index 0000000..67fe213 --- /dev/null +++ b/intl/zh-Hant/messages.json @@ -0,0 +1,17 @@ +{ + "1e5fea50eef843cbffd1d438494912c8": "無法解析路徑 \"{0}\"", + "34319676975b1abf107da7a056abb434": "無效的正規化格式 - \"{0}\"", + "3a7049e42006e8bc19e0f4fc8df63b6b": "'app' 採用不相容的 LoopBack 版本 {0}。支援的版本:{1}", + "3f93b626dd9a1c33d67490f6e71018b5": "警告:遺漏主要配置檔 \"{0}{{.json}}\"", + "4d052d84c8620730afd4a30832f11724": "無法配置不明模型 {0}", + "4ed668e9187650d898acf97707df445a": "主要配置中未定義 {{phase}} \"{0}\"。", + "6447e6b342a2c51ab0bc53b3cbdf3742": "排序衝突:不能將 \"{0}\" 新增至 \"{1}\" 後面,因為已指定相反順序", + "70654dc6eb565613a33344efed3de998": "載入啟動 Script 時失敗:{0}\n{1}", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} 未解析成有效的值,傳回 {1}。\"{2}\" 必須可在環境變數中解析或由 {{app.get()}} 解析。", + "91a742b7c3568cf6b6755741a70b3c52": "主要配置中未定義 {{phase}} \"{1}\" 中的 {{middleware}} \"{0}\"。", + "a3aa22086ae4976cd013065c9a3ff81c": "無法套用 {0}:", + "be2cf2868ba54624fe38e9908dde5e9e": "{{model-config.json}} 中的資料採用不受支援的 {{1.x}} 格式。", + "ec551b6f2fafd8d40af801ebe5bb09f6": "正在捨棄 {{middleware}} 指令,{{loopback}} 用戶端不支援 {{middleware}}。", + "fdc23df1bd0fe55fe3faabcc89ff60f3": "找不到中介軟體 \"{0}\":{1}" +} + From 4f91a4f78ec04d5cff0842d82c6da719a83131d9 Mon Sep 17 00:00:00 2001 From: Allen Boone Date: Fri, 2 Jun 2017 16:21:20 -0400 Subject: [PATCH 10/28] Update Italian translated strings Q2 2017 --- intl/it/messages.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/intl/it/messages.json b/intl/it/messages.json index c1c5ffd..0ac5dd7 100644 --- a/intl/it/messages.json +++ b/intl/it/messages.json @@ -1,17 +1,17 @@ { "1e5fea50eef843cbffd1d438494912c8": "Impossibile risolvere il percorso \"{0}\"", "34319676975b1abf107da7a056abb434": "Formato di normalizzazione non valido - \"{0}\"", - "3a7049e42006e8bc19e0f4fc8df63b6b": "The `app` is powered by an incompatible loopback version {0}. Versioni supportate: {1}", - "3f93b626dd9a1c33d67490f6e71018b5": "WARNING: Main config file \"{0}{{.json}}\" is missing", + "3a7049e42006e8bc19e0f4fc8df63b6b": "La `app` si basa su una versione loopback non compatibile {0}. Versioni supportate: {1}", + "3f93b626dd9a1c33d67490f6e71018b5": "AVVERTENZA: file di configurazione principale \"{0}{{.json}}\" mancante", "4d052d84c8620730afd4a30832f11724": "Impossibile configurare il modello {0} sconosciuto", "4ed668e9187650d898acf97707df445a": "{{phase}} \"{0}\" non definita nella configurazione principale.", "6447e6b342a2c51ab0bc53b3cbdf3742": "Conflitto di ordinamento: impossibile aggiungere \"{0}\" dopo \"{1}\", perché è già stato specificato l'ordine opposto", "70654dc6eb565613a33344efed3de998": "Caricamento dello script di boot non riuscito: {0}\n{1}", - "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} non viene risolto in un valore valido, restituito come {1}. \"{2}\" must be resolvable in Environment variable or by {{app.get()}}.", - "91a742b7c3568cf6b6755741a70b3c52": "The {{middleware}} \"{0}\" in {{phase}} \"{1}\"is not defined in the main config.", - "a3aa22086ae4976cd013065c9a3ff81c": "Cannot apply {0}: ", - "be2cf2868ba54624fe38e9908dde5e9e": "The data in {{model-config.json}} is in the unsupported {{1.x}} format.", + "7f7bdcadb75abfef1bd8a126d547dd6d": "{0} non viene risolto in un valore valido, restituito come {1}. \"{2}\" deve essere risolto in una variabile di ambiente o da {{app.get()}}.", + "91a742b7c3568cf6b6755741a70b3c52": "{{middleware}} \"{0}\" in {{phase}} \"{1}\" non definito nella configurazione principale.", + "a3aa22086ae4976cd013065c9a3ff81c": "Impossibile applicare {0}: ", + "be2cf2868ba54624fe38e9908dde5e9e": "I dati in {{model-config.json}} sono nel formato {{1.x}} non supportato.", "ec551b6f2fafd8d40af801ebe5bb09f6": "Eliminazione delle istruzioni {{middleware}}, il client {{loopback}} non supporta {{middleware}}.", - "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" not found: {1}" + "fdc23df1bd0fe55fe3faabcc89ff60f3": "Middleware \"{0}\" non trovato: {1}" } From 2b596c8c8b8706a321cf40d3564aa984781f99cf Mon Sep 17 00:00:00 2001 From: John McLaughlin Date: Sun, 18 Jun 2017 19:49:16 +0700 Subject: [PATCH 11/28] Support es2015 module exports (Babel, TypeScript) Detect when a script file is an es2015 module created by a transpiler like Babel or TypeScript and use the `default` export instead of `module.exports` in such case. The following artefacts support the new syntax now: - boot scripts - components - middleware - model scripts --- lib/compiler.js | 5 +++-- lib/executor.js | 15 ++++++++------- lib/require.js | 9 +++++++++ test/browser.test.js | 12 +++++++++--- test/executor.test.js | 3 +++ test/fixtures/browser-app/component-config.json | 3 +++ .../browser-app/components/dummy-component-umd.js | 11 +++++++++++ test/fixtures/browser-app/mixins/audited-umd.js | 11 +++++++++++ test/fixtures/browser-app/model-config.json | 3 +++ test/fixtures/browser-app/models/product-umd.js | 11 +++++++++++ test/fixtures/browser-app/models/product-umd.json | 5 +++++ test/fixtures/simple-app/boot/umd.js | 11 +++++++++++ test/fixtures/simple-app/middleware.json | 5 ++++- test/helpers/set-umd-middleware.js | 14 ++++++++++++++ 14 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 lib/require.js create mode 100644 test/fixtures/browser-app/components/dummy-component-umd.js create mode 100644 test/fixtures/browser-app/mixins/audited-umd.js create mode 100644 test/fixtures/browser-app/models/product-umd.js create mode 100644 test/fixtures/browser-app/models/product-umd.json create mode 100644 test/fixtures/simple-app/boot/umd.js create mode 100644 test/helpers/set-umd-middleware.js diff --git a/lib/compiler.js b/lib/compiler.js index b362453..7ba166e 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -14,6 +14,7 @@ var debug = require('debug')('loopback:boot:compiler'); var Module = require('module'); var _ = require('lodash'); var g = require('strong-globalize')(); +var requireNodeOrEsModule = require('./require'); var FILE_EXTENSION_JSON = '.json'; @@ -589,7 +590,7 @@ function resolveMiddlewarePath(rootDir, middleware, config) { // Try to require the module and check if . is a valid // function - var m = require(sourceFile); + var m = requireNodeOrEsModule(sourceFile); if (typeof m[fragment] === 'function') { resolved.sourceFile = sourceFile; return resolved; @@ -778,7 +779,7 @@ function loadMixins(sourceFiles, normalization) { meta.name = name; if (utils.fileExistsSync(metafile)) { // May overwrite name, not sourceFile - _.extend(meta, require(metafile)); + _.extend(meta, requireNodeOrEsModule(metafile)); } meta.sourceFile = filepath; mixinInstructions[meta.name] = meta; diff --git a/lib/executor.js b/lib/executor.js index 17fc02d..a025cf1 100644 --- a/lib/executor.js +++ b/lib/executor.js @@ -10,6 +10,7 @@ var async = require('async'); var path = require('path'); var format = require('util').format; var g = require('strong-globalize')(); +var requireNodeOrEsModule = require('./require'); /** * Execute bootstrap instructions gathered by `boot.compile`. @@ -211,7 +212,7 @@ function defineMixins(app, instructions) { if (!modelBuilder.mixins || !mixins.length) return; mixins.forEach(function(obj) { - var mixin = require(obj.sourceFile); + var mixin = requireNodeOrEsModule(obj.sourceFile); if (typeof mixin === 'function' || mixin.prototype instanceof BaseClass) { debug('Defining mixin %s', obj.name); @@ -244,7 +245,7 @@ function defineModels(app, instructions) { model = registry.createModel(data.definition); if (data.sourceFile) { debug('Loading customization script %s', data.sourceFile); - var code = require(data.sourceFile); + var code = requireNodeOrEsModule(data.sourceFile); if (typeof code === 'function') { debug('Customizing model %s', name); code(model); @@ -288,12 +289,12 @@ function runScripts(app, list, callback) { list.forEach(function(filepath) { debug('Requiring script %s', filepath); try { - var exports = require(filepath); - if (typeof exports === 'function') { + var bootFn = requireNodeOrEsModule(filepath); + if (typeof bootFn === 'function') { debug('Exported function detected %s', filepath); functions.push({ path: filepath, - func: exports, + func: bootFn, }); } } catch (err) { @@ -340,7 +341,7 @@ function setupMiddleware(app, instructions) { middleware.forEach(function(data) { debug('Configuring middleware %j%s', data.sourceFile, data.fragment ? ('#' + data.fragment) : ''); - var factory = require(data.sourceFile); + var factory = requireNodeOrEsModule(data.sourceFile); if (data.fragment) { factory = factory[data.fragment].bind(factory); } @@ -429,7 +430,7 @@ function getUpdatedConfigObject(app, config, opts) { function setupComponents(app, instructions) { instructions.components.forEach(function(data) { debug('Configuring component %j', data.sourceFile); - var configFn = require(data.sourceFile); + var configFn = requireNodeOrEsModule(data.sourceFile); var opts = { useEnvVars: true, }; diff --git a/lib/require.js b/lib/require.js new file mode 100644 index 0000000..a2d5296 --- /dev/null +++ b/lib/require.js @@ -0,0 +1,9 @@ +// Copyright IBM Corp. 2015,2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +module.exports = function requireNodeOrEsModule(sourceFile) { + var exports = require(sourceFile); + return exports && exports.__esModule ? exports.default : exports; +}; diff --git a/test/browser.test.js b/test/browser.test.js index d179aa5..5677383 100644 --- a/test/browser.test.js +++ b/test/browser.test.js @@ -57,10 +57,15 @@ describe('browser support', function() { expect(Object.keys(app.models)).to.include('Customer'); expect(app.models.Customer.settings) .to.have.property('_customized', 'Customer'); + expect(Object.keys(app.models)).to.include('ProductUmd'); + expect(app.models.ProductUmd.settings) + .to.have.property('_customized', 'UMD'); - // configured in fixtures/browser-app/component-config.json - // and fixtures/browser-app/components/dummy-component.js + // configured in fixtures/browser-app/component-config.json, + // fixtures/browser-app/components/dummy-component.js and + // fixtures/browser-app/components/dummy-component-umd.js expect(app.dummyComponentOptions).to.eql({ option: 'value' }); + expect(app.dummyComponentUmdOptions).to.eql({ option: 'valueUmd' }); done(); }); @@ -79,8 +84,9 @@ describe('browser support', function() { var modelBuilder = app.registry.modelBuilder; var registry = modelBuilder.mixins.mixins; - expect(Object.keys(registry)).to.eql(['TimeStamps']); + expect(Object.keys(registry)).to.eql(['AuditedUmd', 'TimeStamps']); expect(app.models.Customer.timeStampsMixin).to.eql(true); + expect(app.models.ProductUmd.auditedMixin).to.eql(true); done(); }); diff --git a/test/executor.test.js b/test/executor.test.js index 7d00b10..bdaf3e3 100644 --- a/test/executor.test.js +++ b/test/executor.test.js @@ -278,6 +278,7 @@ describe('executor', function() { 'barStarted', 'barFinished', 'barSyncExecuted', + 'umdLoaded', ]); done(); }, 10); @@ -294,6 +295,7 @@ describe('executor', function() { 'barStarted', 'barFinished', 'barSyncExecuted', + 'umdLoaded', ]); done(); }); @@ -838,6 +840,7 @@ describe('executor', function() { .end(function(err, res) { if (err) return done(err); expect(res.headers.names).to.equal('custom-middleware'); + expect(res.headers.umd).to.equal('success'); done(); }); }); diff --git a/test/fixtures/browser-app/component-config.json b/test/fixtures/browser-app/component-config.json index 3aa8175..dfff385 100644 --- a/test/fixtures/browser-app/component-config.json +++ b/test/fixtures/browser-app/component-config.json @@ -1,5 +1,8 @@ { "./components/dummy-component": { "option": "value" + }, + "./components/dummy-component-umd": { + "option": "valueUmd" } } diff --git a/test/fixtures/browser-app/components/dummy-component-umd.js b/test/fixtures/browser-app/components/dummy-component-umd.js new file mode 100644 index 0000000..f57fd82 --- /dev/null +++ b/test/fixtures/browser-app/components/dummy-component-umd.js @@ -0,0 +1,11 @@ +// Copyright IBM Corp. 2015,2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +module.exports = { + default: function(app, options) { + app.dummyComponentUmdOptions = options; + }, +}; +Object.defineProperty(module.exports, '__esModule', { value: true }); diff --git a/test/fixtures/browser-app/mixins/audited-umd.js b/test/fixtures/browser-app/mixins/audited-umd.js new file mode 100644 index 0000000..e48f34c --- /dev/null +++ b/test/fixtures/browser-app/mixins/audited-umd.js @@ -0,0 +1,11 @@ +// Copyright IBM Corp. 2014,2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +module.exports = { + default: function(Model, options) { + Model.auditedMixin = true; + }, +}; +Object.defineProperty(module.exports, '__esModule', { value: true }); diff --git a/test/fixtures/browser-app/model-config.json b/test/fixtures/browser-app/model-config.json index c0686a2..6112377 100644 --- a/test/fixtures/browser-app/model-config.json +++ b/test/fixtures/browser-app/model-config.json @@ -7,5 +7,8 @@ }, "Customer": { "dataSource": "db" + }, + "ProductUmd": { + "dataSource": "db" } } diff --git a/test/fixtures/browser-app/models/product-umd.js b/test/fixtures/browser-app/models/product-umd.js new file mode 100644 index 0000000..452339c --- /dev/null +++ b/test/fixtures/browser-app/models/product-umd.js @@ -0,0 +1,11 @@ +// Copyright IBM Corp. 2014,2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +module.exports = { + default: function(ProductUmd) { + ProductUmd.settings._customized = 'UMD'; + }, +}; +Object.defineProperty(module.exports, '__esModule', { value: true }); diff --git a/test/fixtures/browser-app/models/product-umd.json b/test/fixtures/browser-app/models/product-umd.json new file mode 100644 index 0000000..b224205 --- /dev/null +++ b/test/fixtures/browser-app/models/product-umd.json @@ -0,0 +1,5 @@ +{ + "name": "ProductUmd", + "base": "User", + "mixins": {"AuditedUmd": {} } +} diff --git a/test/fixtures/simple-app/boot/umd.js b/test/fixtures/simple-app/boot/umd.js new file mode 100644 index 0000000..976f69b --- /dev/null +++ b/test/fixtures/simple-app/boot/umd.js @@ -0,0 +1,11 @@ +// Copyright IBM Corp. 2014,2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +module.exports = { + default: function(app) { + process.bootFlags.push('umdLoaded'); + }, +}; +Object.defineProperty(module.exports, '__esModule', { value: true }); diff --git a/test/fixtures/simple-app/middleware.json b/test/fixtures/simple-app/middleware.json index 3062e34..57df770 100644 --- a/test/fixtures/simple-app/middleware.json +++ b/test/fixtures/simple-app/middleware.json @@ -2,6 +2,9 @@ "initial": { "../../helpers/push-name-middleware": { "params": "custom-middleware" - } + }, + "../../helpers/set-umd-middleware": { + "params": "success" + } } } diff --git a/test/helpers/set-umd-middleware.js b/test/helpers/set-umd-middleware.js new file mode 100644 index 0000000..962eea4 --- /dev/null +++ b/test/helpers/set-umd-middleware.js @@ -0,0 +1,14 @@ +// Copyright IBM Corp. 2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +module.exports = { + default: function(value) { + return function(req, res, next) { + res.setHeader('umd', value); + next(); + }; + }, +}; +Object.defineProperty(module.exports, '__esModule', { value: true }); From 6db7cadc9b4bca45f1ab888767557f62cbb05542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 26 Jun 2017 15:04:00 +0200 Subject: [PATCH 12/28] 2.25.0 * Support es2015 module exports (Babel, TypeScript) (John McLaughlin) --- CHANGES.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 99ee7ce..f83d434 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +2017-06-26, Version 2.25.0 +========================== + + * Support es2015 module exports (Babel, TypeScript) (John McLaughlin) + + 2017-06-07, Version 2.24.1 ========================== diff --git a/package.json b/package.json index 98d86f3..7589117 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.24.1", + "version": "2.25.0", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From 51326091b20cea96f9841f3163e80588e1c360cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 29 Jul 2017 13:48:28 +0200 Subject: [PATCH 13/28] Add support for ES6 style async boot scripts --- lib/executor.js | 29 +++--- package.json | 1 + test/executor.test.js | 112 ++++++++++++++++------ test/fixtures/simple-app/boot/promise.js | 19 ++++ test/fixtures/simple-app/boot/reject.js | 12 +++ test/fixtures/simple-app/boot/thenable.js | 17 ++++ test/fixtures/simple-app/boot/throw.js | 10 ++ 7 files changed, 160 insertions(+), 40 deletions(-) create mode 100644 test/fixtures/simple-app/boot/promise.js create mode 100644 test/fixtures/simple-app/boot/reject.js create mode 100644 test/fixtures/simple-app/boot/thenable.js create mode 100644 test/fixtures/simple-app/boot/throw.js diff --git a/lib/executor.js b/lib/executor.js index a025cf1..0351aa6 100644 --- a/lib/executor.js +++ b/lib/executor.js @@ -305,17 +305,24 @@ function runScripts(app, list, callback) { async.eachSeries(functions, function(f, done) { debug('Running script %s', f.path); - if (f.func.length >= 2) { - debug('Starting async function %s', f.path); - f.func(app, function(err) { - debug('Async function finished %s', f.path); - done(err); - }); - } else { - debug('Starting sync function %s', f.path); - f.func(app); - debug('Sync function finished %s', f.path); - done(); + var cb = function(err) { + debug('Async function finished %s', f.path); + done(err); + // Make sure done() isn't called twice, e.g. if a script returns a + // thenable object and also calls the passed callback. + cb = null; + }; + try { + var result = f.func(app, cb); + if (result && typeof result.then === 'function') { + result.then(function() { cb(); }, cb); + } else if (f.func.length < 2) { + debug('Sync function finished %s', f.path); + done(); + } + } catch (err) { + debug('Sync function failed %s', f.path, err); + done(err); } }, callback); } diff --git a/package.json b/package.json index 7589117..540cfb2 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ }, "devDependencies": { "browserify": "^4.1.8", + "bluebird": "^3.1.1", "chai": "^1.10.0", "coffee-script": "^1.8.0", "coffeeify": "^0.7.0", diff --git a/test/executor.test.js b/test/executor.test.js index bdaf3e3..1123d3a 100644 --- a/test/executor.test.js +++ b/test/executor.test.js @@ -265,6 +265,8 @@ describe('executor', function() { 'barLoaded', 'barSyncLoaded', 'fooLoaded', + 'promiseLoaded', + 'thenableLoaded', 'barStarted', ]); @@ -275,9 +277,15 @@ describe('executor', function() { 'barLoaded', 'barSyncLoaded', 'fooLoaded', + 'promiseLoaded', + 'thenableLoaded', 'barStarted', 'barFinished', 'barSyncExecuted', + 'promiseStarted', + 'promiseFinished', + 'thenableStarted', + 'thenableFinished', 'umdLoaded', ]); done(); @@ -292,9 +300,15 @@ describe('executor', function() { 'barLoaded', 'barSyncLoaded', 'fooLoaded', + 'promiseLoaded', + 'thenableLoaded', 'barStarted', 'barFinished', 'barSyncExecuted', + 'promiseStarted', + 'promiseFinished', + 'thenableStarted', + 'thenableFinished', 'umdLoaded', ]); done(); @@ -305,7 +319,7 @@ describe('executor', function() { function(done) { var options = { app: app, - appRootDir: path.join(__dirname, './fixtures/simple-app'), + appRootDir: SIMPLE_APP, scriptExtensions: ['.customjs', '.customjs2'], }; boot.execute(app, boot.compile(options), function(err) { @@ -317,44 +331,84 @@ describe('executor', function() { done(); }); }); + }); - describe('for mixins', function() { - var options; - beforeEach(function() { - appdir.writeFileSync('custom-mixins/example.js', - 'module.exports = ' + - 'function(Model, options) {}'); - - appdir.writeFileSync('custom-mixins/time-stamps.js', - 'module.exports = ' + - 'function(Model, options) {}'); + describe('with boot script returning a rejected promise', function() { + before(function() { + // Tell simple-app/boot/reject.js to return a rejected promise + process.rejectPromise = true; + }); - appdir.writeConfigFileSync('custom-mixins/time-stamps.json', { - name: 'Timestamping', - }); + after(function() { + delete process.rejectPromise; + }); - options = { - appRootDir: appdir.PATH, - }; + it('receives rejected promise as callback error', + function(done) { + boot.execute(app, simpleAppInstructions(), function(err) { + expect(err).to.exist.and.be.an.instanceOf(Error) + .with.property('message', 'reject'); + done(); }); + }); + }); - it('defines mixins from instructions - using `mixinDirs`', function() { - options.mixinDirs = ['./custom-mixins']; - boot(app, options); + describe('with boot script throwing an error', function() { + before(function() { + // Tell simple-app/boot/throw.js to throw an error + process.throwError = true; + }); - var modelBuilder = app.registry.modelBuilder; - var registry = modelBuilder.mixins.mixins; - expect(Object.keys(registry)).to.eql(['Example', 'Timestamping']); + after(function() { + delete process.throwError; + }); + + it('receives thrown error as callback errors', + function(done) { + boot.execute(app, simpleAppInstructions(), function(err) { + expect(err).to.exist.and.be.an.instanceOf(Error) + .with.property('message', 'throw'); + done(); }); + }); + }); - it('defines mixins from instructions - using `mixinSources`', function() { - options.mixinSources = ['./custom-mixins']; - boot(app, options); + describe('for mixins', function() { + var options; + beforeEach(function() { + appdir.writeFileSync('custom-mixins/example.js', + 'module.exports = ' + + 'function(Model, options) {}'); + + appdir.writeFileSync('custom-mixins/time-stamps.js', + 'module.exports = ' + + 'function(Model, options) {}'); - var modelBuilder = app.registry.modelBuilder; - var registry = modelBuilder.mixins.mixins; - expect(Object.keys(registry)).to.eql(['Example', 'Timestamping']); + appdir.writeConfigFileSync('custom-mixins/time-stamps.json', { + name: 'Timestamping', }); + + options = { + appRootDir: appdir.PATH, + }; + }); + + it('defines mixins from instructions - using `mixinDirs`', function() { + options.mixinDirs = ['./custom-mixins']; + boot(app, options); + + var modelBuilder = app.registry.modelBuilder; + var registry = modelBuilder.mixins.mixins; + expect(Object.keys(registry)).to.eql(['Example', 'Timestamping']); + }); + + it('defines mixins from instructions - using `mixinSources`', function() { + options.mixinSources = ['./custom-mixins']; + boot(app, options); + + var modelBuilder = app.registry.modelBuilder; + var registry = modelBuilder.mixins.mixins; + expect(Object.keys(registry)).to.eql(['Example', 'Timestamping']); }); }); diff --git a/test/fixtures/simple-app/boot/promise.js b/test/fixtures/simple-app/boot/promise.js new file mode 100644 index 0000000..e8bd9ce --- /dev/null +++ b/test/fixtures/simple-app/boot/promise.js @@ -0,0 +1,19 @@ +// Copyright IBM Corp. 2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +var Promise = require('bluebird'); + +process.bootFlags.push('promiseLoaded'); +module.exports = function(app) { + process.bootFlags.push('promiseStarted'); + return Promise.resolve({ + then: function(onFulfill, onReject) { + process.nextTick(function() { + process.bootFlags.push('promiseFinished'); + onFulfill(); + }); + }, + }); +}; diff --git a/test/fixtures/simple-app/boot/reject.js b/test/fixtures/simple-app/boot/reject.js new file mode 100644 index 0000000..bf47d40 --- /dev/null +++ b/test/fixtures/simple-app/boot/reject.js @@ -0,0 +1,12 @@ +// Copyright IBM Corp. 2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +var Promise = require('bluebird'); + +module.exports = function(app) { + if (process.rejectPromise) { + return Promise.reject(new Error('reject')); + } +}; diff --git a/test/fixtures/simple-app/boot/thenable.js b/test/fixtures/simple-app/boot/thenable.js new file mode 100644 index 0000000..8746b31 --- /dev/null +++ b/test/fixtures/simple-app/boot/thenable.js @@ -0,0 +1,17 @@ +// Copyright IBM Corp. 2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +process.bootFlags.push('thenableLoaded'); +module.exports = function(app) { + process.bootFlags.push('thenableStarted'); + return { + then: function(onFulfill, onReject) { + process.nextTick(function() { + process.bootFlags.push('thenableFinished'); + onFulfill(); + }); + }, + }; +}; diff --git a/test/fixtures/simple-app/boot/throw.js b/test/fixtures/simple-app/boot/throw.js new file mode 100644 index 0000000..f0d2545 --- /dev/null +++ b/test/fixtures/simple-app/boot/throw.js @@ -0,0 +1,10 @@ +// Copyright IBM Corp. 2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +module.exports = function(app) { + if (process.throwError) { + throw new Error('throw'); + } +}; From fa656e4beeb339f89c74397fbcf88afda476a00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 31 Jul 2017 17:34:06 +0200 Subject: [PATCH 14/28] 2.26.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for ES6 style async boot scripts (Jürg Lehni) * Update Italian translated strings Q2 2017 (Allen Boone) * Update translated strings Q2 2017 (Allen Boone) --- CHANGES.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f83d434..94fe2a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,13 @@ +2017-07-31, Version 2.26.0 +========================== + + * Add support for ES6 style async boot scripts (Jürg Lehni) + + * Update Italian translated strings Q2 2017 (Allen Boone) + + * Update translated strings Q2 2017 (Allen Boone) + + 2017-06-26, Version 2.25.0 ========================== diff --git a/package.json b/package.json index 540cfb2..98d44b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.25.0", + "version": "2.26.0", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From c9a1e0cc691e2c4e1fd80840bc0fb02a1475781c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 16 Aug 2017 20:32:06 +0200 Subject: [PATCH 15/28] Do not call callbacks twice in async boot scripts See #252 for details --- lib/executor.js | 4 ++-- test/executor.test.js | 17 +++++++++++++++++ .../simple-app/boot/promise-callback.js | 13 +++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/simple-app/boot/promise-callback.js diff --git a/lib/executor.js b/lib/executor.js index 0351aa6..052f714 100644 --- a/lib/executor.js +++ b/lib/executor.js @@ -306,11 +306,11 @@ function runScripts(app, list, callback) { async.eachSeries(functions, function(f, done) { debug('Running script %s', f.path); var cb = function(err) { - debug('Async function finished %s', f.path); + debug('Async function %s %s', err ? 'failed' : 'finished', f.path); done(err); // Make sure done() isn't called twice, e.g. if a script returns a // thenable object and also calls the passed callback. - cb = null; + cb = function() {}; }; try { var result = f.func(app, cb); diff --git a/test/executor.test.js b/test/executor.test.js index 1123d3a..40646a2 100644 --- a/test/executor.test.js +++ b/test/executor.test.js @@ -373,6 +373,23 @@ describe('executor', function() { }); }); + describe('with boot script returning a promise and calling callback', + function() { + before(function() { + process.promiseAndCallback = true; + }); + + after(function() { + delete process.promiseAndCallback; + }); + + it('should only call the callback once', function(done) { + // Note: Mocha will fail this test if done() is called twice + boot.execute(app, simpleAppInstructions(), done); + }); + } + ); + describe('for mixins', function() { var options; beforeEach(function() { diff --git a/test/fixtures/simple-app/boot/promise-callback.js b/test/fixtures/simple-app/boot/promise-callback.js new file mode 100644 index 0000000..4618a06 --- /dev/null +++ b/test/fixtures/simple-app/boot/promise-callback.js @@ -0,0 +1,13 @@ +// Copyright IBM Corp. 2017. All Rights Reserved. +// Node module: loopback-boot +// This file is licensed under the MIT License. +// License text available at https://opensource.org/licenses/MIT + +var Promise = require('bluebird'); + +module.exports = function(app, callback) { + callback(); + if (process.promiseAndCallback) { + return Promise.reject(); + } +}; From cdab45d40e354eea6430494b273a54e78b905c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 17 Aug 2017 09:58:23 +0200 Subject: [PATCH 16/28] 2.26.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Do not call callbacks twice in async boot scripts (Jürg Lehni) --- CHANGES.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 94fe2a9..3bb867d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +2017-08-17, Version 2.26.1 +========================== + + * Do not call callbacks twice in async boot scripts (Jürg Lehni) + + 2017-07-31, Version 2.26.0 ========================== diff --git a/package.json b/package.json index 98d44b2..afd1cfd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.26.0", + "version": "2.26.1", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From e81e1952b56b4a502d299d95b4f43bda182b8a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 14 Sep 2017 11:16:43 +0200 Subject: [PATCH 17/28] Add CODEOWNERS file --- CODEOWNERS | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..924a2a9 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,5 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners, +# the last matching pattern has the most precendence. + +* @bajtos @lehni From 3d3609defe4ea97a3ce7a9c8567a2992d72efd87 Mon Sep 17 00:00:00 2001 From: Zak Barbuto Date: Thu, 14 Sep 2017 09:20:15 +0930 Subject: [PATCH 18/28] Ignore js sourcemap files from boot --- lib/compiler.js | 6 ++++++ test/compiler.test.js | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index 7ba166e..94e8979 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -661,6 +661,12 @@ function resolveRelativePaths(relativePaths, appRootDir) { function getExcludedExtensions() { return { '.json': '.json', + /** + * This is a temporary workaround for #246 + * See discussion here for full description of the underlying issue + * https://github.com/strongloop/loopback-boot/pull/245#issuecomment-311052798 + */ + '.map': '.map', '.node': 'node', }; } diff --git a/test/compiler.test.js b/test/compiler.test.js index a93d776..52baede 100644 --- a/test/compiler.test.js +++ b/test/compiler.test.js @@ -2187,6 +2187,24 @@ describe('compiler', function() { 'sourceFile', coffee); }); + it('ignores sourcmap files when loading middleware', + function() { + var middleware = appdir.writeFileSync('my-middleware.js', + '// I am the middleware'); + var sourcemap = appdir.writeFileSync('my-middleware.js.map', + '// I am a sourcemap'); + appdir.writeConfigFileSync('middleware.json', { + 'routes': { + './my-middleware': {}, + }, + }); + + var instructions = boot.compile(appdir.PATH); + + expect(instructions.middleware.middleware[0]).have.property( + 'sourceFile', middleware); + }); + describe('config with relative paths in params', function() { var RELATIVE_PATH_PARAMS = [ '$!./here', From b668116fab18a76292ff0c1e58586ecfc5c63848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 15 Sep 2017 10:43:45 +0200 Subject: [PATCH 19/28] 2.26.2 * Ignore js sourcemap files from boot (Zak Barbuto) --- CHANGES.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 3bb867d..28c449d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +2017-09-15, Version 2.26.2 +========================== + + * Ignore js sourcemap files from boot (Zak Barbuto) + + 2017-08-17, Version 2.26.1 ========================== diff --git a/package.json b/package.json index afd1cfd..15c2c8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.26.1", + "version": "2.26.2", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From cb5651c584e7be9b8d4cb6b327c2698d43b7bc32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 25 Sep 2017 09:56:54 +0200 Subject: [PATCH 20/28] CODEOWNERS: add zbarbuto --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 924a2a9..f16aaf3 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,4 +2,4 @@ # Each line is a file pattern followed by one or more owners, # the last matching pattern has the most precendence. -* @bajtos @lehni +* @bajtos @lehni @zbarbuto From ff5db9696be1fc8c6da45ab24d6c90917ebe4c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 19 Oct 2017 10:50:31 +0200 Subject: [PATCH 21/28] CODEOWNERS: move @lehni to Alumni section --- CODEOWNERS | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index f16aaf3..6588418 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,4 +2,10 @@ # Each line is a file pattern followed by one or more owners, # the last matching pattern has the most precendence. -* @bajtos @lehni @zbarbuto +# Current maintainers + +* @bajtos @zbarbuto + +# Alumni +# +# @lehni From b0408f250dff972eba72c878541e7c3e2d31e4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 19 Oct 2017 10:57:06 +0200 Subject: [PATCH 22/28] Drop support for Node.js versions 0.10 and 0.12 Some of our dependencies are no longer supporting pre-4.0 versions of Node.js. As a result, our CI builds are failing on these platforms. This pull request removes 0.10 and 0.12 from our Travis CI build matrix and also adds "engines" field to package.json to tell our internal Jenkins CI to stop testing 0.10 and 0.12 versions too. --- .travis.yml | 3 +-- package.json | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d431fa4..504c75d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ sudo: false language: node_js node_js: - - "0.10" - - "0.12" - "4" - "6" + - "8" diff --git a/package.json b/package.json index 15c2c8e..7392a84 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ "posttest": "npm run lint", "lint": "eslint ." }, + "engines": { + "node": ">=4" + }, "license": "MIT", "dependencies": { "async": "~0.9.0", From 5060032d265bd457c14ea2510ecd0d017a7a2f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 23 Oct 2017 09:28:19 +0200 Subject: [PATCH 23/28] 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Drop support for Node.js versions 0.10 and 0.12 (Miroslav Bajtoš) * CODEOWNERS: move @lehni to Alumni section (Miroslav Bajtoš) * CODEOWNERS: add zbarbuto (Miroslav Bajtoš) * Add CODEOWNERS file (Miroslav Bajtoš) --- CHANGES.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 28c449d..f1b209a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,15 @@ +2017-10-23, Version 2.27.0 +========================== + + * Drop support for Node.js versions 0.10 and 0.12 (Miroslav Bajtoš) + + * CODEOWNERS: move @lehni to Alumni section (Miroslav Bajtoš) + + * CODEOWNERS: add zbarbuto (Miroslav Bajtoš) + + * Add CODEOWNERS file (Miroslav Bajtoš) + + 2017-09-15, Version 2.26.2 ========================== diff --git a/package.json b/package.json index 7392a84..26d1742 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.26.2", + "version": "2.27.0", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From 81cdf6b42d93b094cf75a69e04308355ae73d50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 19 Feb 2018 11:40:52 +0100 Subject: [PATCH 24/28] Upgrade lodash from 3.x to 4.x --- lib/compiler.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 94e8979..71a745f 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -469,7 +469,7 @@ function tryResolveAppPath(rootDir, relativePath, resolveOptions) { function loadModelDefinition(rootDir, jsonFile, allFiles, scriptExtensions) { var definition = require(jsonFile); var basename = path.basename(jsonFile, path.extname(jsonFile)); - definition.name = definition.name || _.capitalize(_.camelCase(basename)); + definition.name = definition.name || _.upperFirst(_.camelCase(basename)); // find a matching file with a supported extension like `.js` or `.coffee` var sourceFile = fixFileExtension(jsonFile, allFiles, scriptExtensions); @@ -626,7 +626,7 @@ function resolveMiddlewarePath(rootDir, middleware, config) { var MIDDLEWARE_PATH_PARAM_REGEX = /^\$!(\.\/|\.\.\/)/; function resolveMiddlewareParams(rootDir, params) { - return cloneDeep(params, function resolvePathParam(value) { + return _.cloneDeepWith(params, function resolvePathParam(value) { if (typeof value === 'string' && MIDDLEWARE_PATH_PARAM_REGEX.test(value)) { return path.resolve(rootDir, value.slice(2)); } else { diff --git a/package.json b/package.json index 26d1742..3025be4 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "async": "~0.9.0", "commondir": "0.0.1", "debug": "^2.0.0", - "lodash": "^3.6.0", + "lodash": "^4.17.5", "semver": "^4.1.0", "strong-globalize": "^2.6.2", "toposort": "^0.2.10" From 2746bf5bdebc66ca6cacc0184f07ff911f9c7cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 26 Feb 2018 16:52:59 +0100 Subject: [PATCH 25/28] 2.27.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Upgrade lodash from 3.x to 4.x (Miroslav Bajtoš) --- CHANGES.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f1b209a..4dcfcef 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +2018-02-26, Version 2.27.1 +========================== + + * Upgrade lodash from 3.x to 4.x (Miroslav Bajtoš) + + 2017-10-23, Version 2.27.0 ========================== diff --git a/package.json b/package.json index 3025be4..b328208 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.27.0", + "version": "2.27.1", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From bea9a5f7d9a1a1e7a023f8638f26bfbf586f6a86 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Fri, 22 Mar 2019 13:35:29 -0700 Subject: [PATCH 26/28] chore: upgrade deps to fix npm audit complaints --- .travis.yml | 1 - package.json | 24 ++++++++++++------------ test/executor.test.js | 2 +- test/helpers/browser.js | 3 ++- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 504c75d..a231ba5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ sudo: false language: node_js node_js: - - "4" - "6" - "8" diff --git a/package.json b/package.json index b328208..d721426 100644 --- a/package.json +++ b/package.json @@ -20,29 +20,29 @@ "lint": "eslint ." }, "engines": { - "node": ">=4" + "node": ">=6" }, "license": "MIT", "dependencies": { - "async": "~0.9.0", - "commondir": "0.0.1", - "debug": "^2.0.0", - "lodash": "^4.17.5", - "semver": "^4.1.0", - "strong-globalize": "^2.6.2", - "toposort": "^0.2.10" + "async": "^0.9.2", + "commondir": "^1.0.1", + "debug": "^3.2.6", + "lodash": "^4.17.11", + "semver": "^5.6.0", + "strong-globalize": "^4.1.3", + "toposort": "^2.0.2" }, "devDependencies": { - "browserify": "^4.1.8", "bluebird": "^3.1.1", + "browserify": "^16.2.3", "chai": "^1.10.0", "coffee-script": "^1.8.0", "coffeeify": "^0.7.0", "eslint": "^2.5.3", "eslint-config-loopback": "^1.0.0", - "fs-extra": "^0.12.0", + "fs-extra": "^7.0.1", "loopback": "^2.16.3", - "mocha": "^1.19.0", - "supertest": "^0.14.0" + "mocha": "^6.0.2", + "supertest": "^4.0.2" } } diff --git a/test/executor.test.js b/test/executor.test.js index 40646a2..1cbb5e4 100644 --- a/test/executor.test.js +++ b/test/executor.test.js @@ -237,7 +237,7 @@ describe('executor', function() { it('skips definition of already defined LoopBack models', function() { var builtinModel = { name: 'User', - definition: fs.readJsonFileSync( + definition: fs.readJson( require.resolve('loopback/common/models/user.json') ), config: { dataSource: 'db' }, diff --git a/test/helpers/browser.js b/test/helpers/browser.js index 5580e0f..c063a3a 100644 --- a/test/helpers/browser.js +++ b/test/helpers/browser.js @@ -8,7 +8,8 @@ var vm = require('vm'); function createContext() { var context = { // required by browserify - XMLHttpRequest: function() { throw new Error('not implemented'); }, + XMLHttpRequest: function() {}, + clearTimeout: function() {}, FormData: function() { throw new Error('not implemented'); }, localStorage: { From bb5d4239defcbd4cbc777fdf98996a1d435c79f6 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Tue, 26 Mar 2019 10:58:56 -0700 Subject: [PATCH 27/28] 2.28.0 * chore: upgrade deps to fix npm audit complaints (Raymond Feng) --- CHANGES.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 4dcfcef..0d45599 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +2019-03-26, Version 2.28.0 +========================== + + * chore: upgrade deps to fix npm audit complaints (Raymond Feng) + + 2018-02-26, Version 2.27.1 ========================== diff --git a/package.json b/package.json index d721426..c44390e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.27.1", + "version": "2.28.0", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop", From c746d807bb3a6b65ae3e48b99a30e931d0bc1bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 25 Jun 2019 08:39:03 +0200 Subject: [PATCH 28/28] Tag 2.x versions as `lts` in npm registry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index c44390e..1a6f9a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "loopback-boot", "version": "2.28.0", + "publishConfig": { + "tag": "lts" + }, "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop",