Skip to content

Commit 5d2017c

Browse files
committed
Generate and use source maps for debugging uglified code
1 parent 25b4be2 commit 5d2017c

5 files changed

Lines changed: 70 additions & 53 deletions

File tree

build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
version=14.1.1
16+
version=14.2.0

docs/ReleaseNotes.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ Release Notes for Version 14
33

44
Build 003
55
-------
6-
Published as version 14.1.1
6+
Published as version 14.2.0
7+
8+
New Features:
9+
* Added source maps to the npm package so that you can debug into the original ilib code easily
710

811
Bug Fixes:
912
* Worked around a problem with uglifyjs which optimized out a block

js/build.xml

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -287,28 +287,32 @@ limitations under the License.
287287
<replace token="// !macro ilibVersion" value='"${version}"' preserveLastModified="true">
288288
<fileset dir="${build.output.js}" includes="ilib.js"/>
289289
</replace>
290-
<exec osfamily="unix" executable="uglifyjs" dir="${build.base}" failifexecutionfails="true">
290+
<exec osfamily="unix" executable="uglifyjs" dir="${build.base}" failifexecutionfails="true">
291291
<env key="PATH" path="${env.PATH}:${nm.bin}"/>
292-
<arg value="${build.output.js}/ilib.js"/>
292+
<arg value="${build.output.js}/ilib.js"/>
293293
<arg value="--comments"/>
294294
<arg value="/\!(data|loadLocaleData|defineLocaleData|macro)/"/>
295-
<arg value="-o"/>
296-
<arg value="${build.output.dyncode}/ilib.js"/>
297-
<arg value="--no-mangle-functions"/>
295+
<arg value="-o"/>
296+
<arg value="${build.output.dyncode}/ilib.js"/>
297+
<arg value="--no-mangle-functions"/>
298298
<arg value="-c"/>
299-
<arg value="-v"/>
300-
</exec>
301-
<exec osfamily="windows" executable="uglifyjs" dir="${build.base}" failifexecutionfails="true">
299+
<arg value="-v"/>
300+
<arg value="--source-map"/>
301+
<arg value="includeSources"/>
302+
</exec>
303+
<exec osfamily="windows" executable="uglifyjs" dir="${build.base}" failifexecutionfails="true">
302304
<env key="PATH" path="${env.PATH}:${nm.bin}"/>
303-
<arg value="${build.output.js}/ilib.js"/>
305+
<arg value="${build.output.js}/ilib.js"/>
304306
<arg value="--comments"/>
305307
<arg value="/\!(data|loadLocaleData|defineLocaleData|macro)/"/>
306308
<arg value="-o"/>
307-
<arg value="${build.output.dyncode}/ilib.js"/>
308-
<arg value="--no-mangle-functions"/>
309+
<arg value="${build.output.dyncode}/ilib.js"/>
310+
<arg value="--no-mangle-functions"/>
309311
<arg value="-c"/>
310-
<arg value="-v"/>
311-
</exec>
312+
<arg value="-v"/>
313+
<arg value="--source-map"/>
314+
<arg value="includeSources"/>
315+
</exec>
312316
<exec osfamily="unix" executable="node" dir="${build.base}" failifexecutionfails="true">
313317
<env key="PATH" path="${env.PATH}:${nm.bin}"/>
314318
<arg value="${build.tools.qmlizer}/qmlizer.js"/>
@@ -324,14 +328,16 @@ limitations under the License.
324328

325329
<!-- then do all the rest of them -->
326330
<apply osfamily="unix" executable="uglifyjs" dest="${build.output.dyncode}" parallel="false">
327-
<srcfile/>
328-
<arg value="--comments"/>
329-
<arg value="/\!(data|loadLocaleData|defineLocaleData|macro)/"/>
331+
<srcfile/>
332+
<arg value="--comments"/>
333+
<arg value="/\!(data|loadLocaleData|defineLocaleData|macro)/"/>
330334
<arg value="-o"/>
331-
<targetfile/>
332-
<arg value="--no-mangle-functions"/>
335+
<targetfile/>
336+
<arg value="--no-mangle-functions"/>
333337
<arg value="-c"/>
334-
<arg value="-v"/>
338+
<arg value="-v"/>
339+
<arg value="--source-map"/>
340+
<arg value="includeSources"/>
335341
<fileset dir="${build.lib}">
336342
<include name="*.js"/>
337343
<exclude name="ilib.js"/>
@@ -348,21 +354,23 @@ limitations under the License.
348354
<fileset dir="${build.base}">
349355
<include name="index.js"/>
350356
</fileset>
351-
<mapper type="glob" from="*.js" to="*.js"/>
352-
</apply>
353-
<apply osfamily="windows" executable="uglifyjs.bat" dest="${build.output.dyncode}" parallel="false">
354-
<srcfile/>
357+
<mapper type="glob" from="*.js" to="*.js"/>
358+
</apply>
359+
<apply osfamily="windows" executable="uglifyjs.bat" dest="${build.output.dyncode}" parallel="false">
360+
<srcfile/>
355361
<arg value="--comments"/>
356362
<arg value="/\!(data|loadLocaleData|defineLocaleData|macro)/"/>
357363
<arg value="-o"/>
358-
<targetfile/>
359-
<arg value="--no-mangle-functions"/>
360-
<arg value="-c"/>
361-
<arg value="-v"/>
362-
<fileset dir="${build.lib}" includes="*.js" excludes="ilib.js,ilib-*.js,runner.js,externs.js,datefmtstr.js"/>
363-
<fileset dir="${build.lib}" includes="ilib-node*.js,ilib-webpack.js,ilib-stubs*,ilib-web.js,ilib-qt.js"/>
364-
<mapper type="glob" from="*.js" to="*.js"/>
365-
</apply>
364+
<targetfile/>
365+
<arg value="--no-mangle-functions"/>
366+
<arg value="-c"/>
367+
<arg value="-v"/>
368+
<arg value="--source-map"/>
369+
<arg value="includeSources"/>
370+
<fileset dir="${build.lib}" includes="*.js" excludes="ilib.js,ilib-*.js,runner.js,externs.js,datefmtstr.js"/>
371+
<fileset dir="${build.lib}" includes="ilib-node*.js,ilib-webpack.js,ilib-stubs*,ilib-web.js,ilib-qt.js"/>
372+
<mapper type="glob" from="*.js" to="*.js"/>
373+
</apply>
366374
<apply osfamily="unix" executable="node" dest="${build.output.dyncode}" parallel="false" force="true">
367375
<arg value="${build.tools.qmlizer}/qmlizer.js"/>
368376
<srcfile/>
@@ -439,25 +447,26 @@ limitations under the License.
439447
<target name="dist" depends="update.package.json,assemble.core,assemble.standard,assemble.full,assemble.dynamic,doc" description="Create all distribution objects and exports them to the top level dir for packaging">
440448
<mkdir dir="${build.export}/js/assembled"/>
441449
<copy todir="${build.export}/js/assembled">
442-
<fileset dir="${build.output.js}">
443-
<include name="core-assembled-uncompiled-web/*.js"/>
444-
<include name="core-assembled-compiled-web/*.js"/>
445-
<include name="standard-assembled-uncompiled-web/*.js"/>
446-
<include name="standard-assembled-compiled-web/*.js"/>
447-
<include name="full-assembled-uncompiled-web/*.js"/>
448-
<include name="full-assembled-compiled-web/*.js"/>
449-
<include name="core-dynamicdata-uncompiled-web/*.js"/>
450-
<include name="core-dynamicdata-compiled-web/*.js"/>
451-
<include name="standard-dynamicdata-uncompiled-web/*.js"/>
452-
<include name="standard-dynamicdata-compiled-web/*.js"/>
453-
<include name="full-dynamicdata-uncompiled-web/*.js"/>
454-
<include name="full-dynamicdata-compiled-web/*.js"/>
455-
</fileset>
450+
<fileset dir="${build.output.js}">
451+
<include name="core-assembled-uncompiled-web/*.js"/>
452+
<include name="core-assembled-compiled-web/*.js"/>
453+
<include name="standard-assembled-uncompiled-web/*.js"/>
454+
<include name="standard-assembled-compiled-web/*.js"/>
455+
<include name="full-assembled-uncompiled-web/*.js"/>
456+
<include name="full-assembled-compiled-web/*.js"/>
457+
<include name="core-dynamicdata-uncompiled-web/*.js"/>
458+
<include name="core-dynamicdata-compiled-web/*.js"/>
459+
<include name="standard-dynamicdata-uncompiled-web/*.js"/>
460+
<include name="standard-dynamicdata-compiled-web/*.js"/>
461+
<include name="full-dynamicdata-uncompiled-web/*.js"/>
462+
<include name="full-dynamicdata-compiled-web/*.js"/>
463+
</fileset>
456464
</copy>
457465
<mkdir dir="${build.export}/js/dyncode"/>
458466
<copy todir="${build.export}/js/dyncode">
459467
<fileset dir="${build.output.dyncode}">
460468
<include name="**/*.js"/>
469+
<include name="**/*.js.map"/>
461470
</fileset>
462471
</copy>
463472
<mkdir dir="${build.export}/doc/jsdoc"/>
@@ -470,7 +479,7 @@ limitations under the License.
470479
<copy todir="${build.export}/src/js">
471480
<fileset dir="${build.base}">
472481
<include name="lib/**"/>
473-
<include name="index.js"/>
482+
<include name="index.js*"/>
474483
<include name="build.xml"/>
475484
<include name="build.properties"/>
476485
<include name="data/locale/**/*.json"/>
@@ -513,7 +522,7 @@ limitations under the License.
513522
</copy>
514523
<copy todir="${build.export}/package">
515524
<fileset dir="${build.export}/js/dyncode">
516-
<include name="index.js"/>
525+
<include name="index.js*"/>
517526
</fileset>
518527
</copy>
519528
<copy todir="${build.export}/package/locale">

js/webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ module.exports = function(env, args) {
9393
target: target
9494
}
9595
}
96+
},{
97+
test: /\.js$/,
98+
use: ["source-map-loader"],
99+
enforce: "pre"
96100
}]
97101
},
98102
plugins: [
@@ -126,6 +130,7 @@ module.exports = function(env, args) {
126130
ret.plugins.splice(0, 0, new UglifyJsPlugin({
127131
cache: true,
128132
parallel: 4,
133+
sourceMap: true,
129134
uglifyOptions: {
130135
compress: true,
131136
warnings: true

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ilib",
3-
"version": "14.1.1",
3+
"version": "14.2.0",
44
"main": "js/lib/ilib-node.js",
55
"description": "iLib is a cross-engine library of internationalization (i18n) classes written in pure JS",
66
"keywords": [
@@ -50,7 +50,7 @@
5050
},
5151
"engines": {
5252
"ringojs": ">=0.9",
53-
"nodejs": ">= 0.10"
53+
"node": ">= 0.10"
5454
},
5555
"devDependencies": {
5656
"babel-loader": "^7.1.2",
@@ -61,7 +61,7 @@
6161
"grunt-contrib-clean": "^1.1.0",
6262
"grunt-contrib-compress": "^1.4.3",
6363
"grunt-contrib-copy": "^1.0.0",
64-
"grunt-contrib-uglify": "^3.4.0",
64+
"grunt-contrib-uglify": "~0.5.0",
6565
"grunt-eslint": "^21.0.0",
6666
"grunt-http-server": "^2.1.0",
6767
"grunt-jsdoc": "^2.2.1",
@@ -71,13 +71,13 @@
7171
"grunt-contrib-nodeunit": "~0.4.1",
7272
"grunt-shell": "^2.1.0",
7373
"grunt-text-replace": "^0.4.0",
74-
"grunt-contrib-uglify": "~0.5.0",
7574
"http-server": "^0.11.1",
7675
"ilib-webpack-loader": "^1.0.2",
7776
"ilib-webpack-plugin": "^1.0.2",
7877
"iso-15924": "^2.0.0",
7978
"jsdoc2": "^2.4.0",
8079
"should": ">=11.1.0",
80+
"source-map-loader": "^0.2.4",
8181
"tap": "^10.0.2",
8282
"trireme": "^0.9.0",
8383
"uglify-js": "^3.3.0",

0 commit comments

Comments
 (0)