From bacbb08e441044e1b3018b85c61497c84b43b19f Mon Sep 17 00:00:00 2001 From: Rafael Xavier de Souza Date: Tue, 7 Oct 2014 14:41:43 -0300 Subject: [PATCH] Use AMD paths mappings Fixes #73 --- .bowerrc | 3 --- Intl.js | 6 +++--- impl/calendarFunctions.js | 4 ++-- impl/calendars.js | 2 +- impl/common.js | 14 +++++++------- impl/load.js | 4 ++-- tests/intern.js | 8 ++++++-- 7 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 .bowerrc diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 902c1933..00000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": ".." -} diff --git a/Intl.js b/Intl.js index ff554be9..f55117c5 100644 --- a/Intl.js +++ b/Intl.js @@ -1,7 +1,7 @@ define([ "./impl/Record", "./impl/calendars", "./impl/common", "./locales!", - "requirejs-text/text!./cldr/supplemental/currencyData.json", - "requirejs-text/text!./cldr/supplemental/timeData.json", - "requirejs-text/text!./cldr/supplemental/numberingSystems.json" ], + "text!cldr/supplemental/currencyData.json", + "text!cldr/supplemental/timeData.json", + "text!cldr/supplemental/numberingSystems.json" ], function (Record, calendars, common, preloads, currencyDataJson, timeDataJson, numberingSystemsJson) { /** diff --git a/impl/calendarFunctions.js b/impl/calendarFunctions.js index ebedcdd2..9bb7fa38 100644 --- a/impl/calendarFunctions.js +++ b/impl/calendarFunctions.js @@ -1,4 +1,4 @@ -define([ "./Record", "requirejs-text/text!../cldr/supplemental/calendarData.json"], +define([ "./Record", "text!cldr/supplemental/calendarData.json"], function (Record, calendarDataJson) { /** * Utility functions that are common across multiple @@ -73,4 +73,4 @@ define([ "./Record", "requirejs-text/text!../cldr/supplemental/calendarData.json } }; return calendarFunctions; -}); \ No newline at end of file +}); diff --git a/impl/calendars.js b/impl/calendars.js index e607c37d..5c9c0778 100644 --- a/impl/calendars.js +++ b/impl/calendars.js @@ -1,5 +1,5 @@ define([ "./Record", - "requirejs-text/text!../cldr/config/calendarDependencies.json", + "text!cldr/config/calendarDependencies.json", "../calendars/gregorianCalendar"], /** * Functions and data related to implementation of calendars. diff --git a/impl/common.js b/impl/common.js index f53898e4..e32a69da 100644 --- a/impl/common.js +++ b/impl/common.js @@ -2,12 +2,12 @@ * Commonly used routines throughout ECMA-402 package. Also referred to in the standard as "Abstract Operations" */ define(["./List", "./Record", - "requirejs-text/text!../cldr/config/availableLocales.json", - "requirejs-text/text!../cldr/supplemental/aliases.json", - "requirejs-text/text!../cldr/supplemental/localeAliases.json", - "requirejs-text/text!../cldr/supplemental/parentLocales.json", - "requirejs-text/text!../cldr/supplemental/likelySubtags.json", - "requirejs-text/text!../cldr/supplemental/calendarPreferenceData.json", + "text!cldr/config/availableLocales.json", + "text!cldr/supplemental/aliases.json", + "text!cldr/supplemental/localeAliases.json", + "text!cldr/supplemental/parentLocales.json", + "text!cldr/supplemental/likelySubtags.json", + "text!cldr/supplemental/calendarPreferenceData.json", ], function (List, Record, availableLocalesJson, aliasesJson, localeAliasesJson, parentLocalesJson, likelySubtagsJson, calendarPreferenceDataJson) { @@ -724,4 +724,4 @@ define(["./List", "./Record", common.availableLocalesList = common.CanonicalizeLocaleList(JSON.parse(availableLocalesJson).availableLocales); return common; - }); \ No newline at end of file + }); diff --git a/impl/load.js b/impl/load.js index fd48554a..c0d726e8 100644 --- a/impl/load.js +++ b/impl/load.js @@ -8,7 +8,7 @@ define([ "./common", "require", "module", - "requirejs-text/text" // just so builder knows we will be using that module + "text" // just so builder knows we will be using that module ], function (calendars, common, require, module) { return { id: module.id, @@ -38,7 +38,7 @@ define([ dependencies = jsonElements = [config._layerMid + "_" + locale]; } else { dependencies = jsonElements.map(function (element) { - return "requirejs-text/text!../cldr/" + locale + "/" + element + ".json"; + return "text!cldr/" + locale + "/" + element + ".json"; }); } diff --git a/tests/intern.js b/tests/intern.js index 2fc696bf..03ad1f53 100644 --- a/tests/intern.js +++ b/tests/intern.js @@ -44,15 +44,19 @@ define({ // loader useLoader: { "host-node": "requirejs", - "host-browser": "../../../requirejs/require.js" + "host-browser": "../../bower_components/requirejs/require.js" }, // Configuration options for the module loader; any AMD configuration options supported by the specified AMD loader // can be used here loader: { - baseUrl: "..", config : { "ecma402/locales" : /^(ar|de(-CH)?|el|en(-(GB|NZ))?|es|fr|he|hi|id|ja|pt.*|sl|sr(-Latn)?|th|zh.*)$/ + }, + paths: { + "ecma402": ".", + "requirejs-dplugins": "bower_components/requirejs-dplugins", + "text": "bower_components/requirejs-text/text" } },