stealjs / steal-tools

Build easy. Load fast.
https://stealjs.com/docs/steal-tools.html
MIT License
67 stars 23 forks source link

i have a problim problems with billing my canJS proge project #121

Closed meded90 closed 9 years ago

meded90 commented 9 years ago

If I add "./style.css!" in deps after the command "grunt build" I have here such error

Running "stealBuild:main" (stealBuild) task
OPENING: editor/modules/code-editor/code-editor
OPENING: editor/modules/code-editor/code-editor

Transpiling...
ERROR: Cannot read property 'normalizeMap' of undefined TypeError: Cannot read property 'normalizeMap' of undefined
    at module.exports (/home/vagrant/lp-editor/node_modules/steal-tools/node_modules/transpile/lib/cjs_amd.js:11:12)
    at Object.transpile.to (/home/vagrant/lp-editor/node_modules/steal-tools/node_modules/transpile/main.js:74:18)
    at module.exports (/home/vagrant/lp-editor/node_modules/steal-tools/lib/graph/transpile.js:11:38)
    at /home/vagrant/lp-editor/node_modules/steal-tools/lib/build/multi.js:122:3
    at eval (eval at <anonymous> (/home/vagrant/lp-editor/node_modules/steal-tools/node_modules/traceur/src/node/traceur.js:24:17), <anonymous>:1572:100)
    at promiseHandle (eval at <anonymous> (/home/vagrant/lp-editor/node_modules/steal-tools/node_modules/traceur/src/node/traceur.js:24:17), <anonymous>:1666:20)
    at eval (eval at <anonymous> (/home/vagrant/lp-editor/node_modules/steal-tools/node_modules/traceur/src/node/traceur.js:24:17), <anonymous>:1660:9)
    at flush (eval at <anonymous> (/home/vagrant/lp-editor/node_modules/steal-tools/node_modules/traceur/src/node/traceur.js:24:17), <anonymous>:1462:7)
    at process._tickCallback (node.js:419:13)
Build was successful.

and why is written here "bootstrap.csscss" https://github.com/bitovi/steal-can-example/blob/master/stealconfig.js#L38

matthewp commented 9 years ago

Which version of steal-tools are you using?

matthewp commented 9 years ago

Can you provide some sample code?

meded90 commented 9 years ago

tested on 0.3.0 and 0.4.0 and 0.5.0

my code stealconfig.js

System.config({
    map: {
        //"can/util/jquery/jquery": "bower_components/jquery/dist/jquery",
        "jquery/jquery": "jquery"

    },

    paths: {
        "jquery": "bower_components/jquery/dist/jquery.js",
        "can": "bower_components/canjs/can.js",
        "can/*": "bower_components/canjs/*.js",
        "canui/*": "bower_components/canui/*.js",
        "jquery/*": "bower_components/jquerypp/*.js",
        "theme/*": "bower_components/jquery-ui/themes/base/jquery.ui.*css",
        "ui/*": "bower_components/jquery-ui/ui/jquery.ui.*.js",
        "bootstrap" : "bower_components/bootstrap/dist/js/bootstrap.js",
        "bootstrap.css" : "bower_components/bootstrap/dist/css/bootstrap.csscss",

        '$css': 'text.js'

    },
    ext: {
        ejs: "can/view/ejs/system",
        mustache: "can/view/mustache/system",
        stache: "can/view/stache/system",
        //js: "bower_components/steal/js",
        css: "text",
        text: '$text'
    },
    //bundle: ["editor/modules/code-editor/code-editor"],
    meta: {
        jquery: {
            format: "amd",
            exports: "jQuery"
        },
        'jquery/jquery': {
            format: "amd",
            exports: "jQuery",
            deps: ["jquery"]
        },

        "ui/core": {deps: ["jquery", "theme/core.css!", "theme/theme.css!"]},
        "ui/widget": {deps: ["jquery"]},
        "ui/accordion": {deps: ["ui/core", "ui/widget", "theme/accordion.css!"]},

        'bower_components/jquery-throttle-debounce/jquery.ba-throttle-debounce': {
            format: "global",

            exports: "jQuery",
            deps: ["jquery"]
        },
        'bower_components/tinymce/tinymce.jquery': {
            format: "global",

            exports: "jQuery",
            deps: ["jquery", 'bower_components/tinymce/skins/lightgray/skin.min.css'
            ]
        },
        'bower_components/tinymce/jquery.tinymce.min': {
            format: "global",

            exports: "jQuery",
            deps: ["jquery", 'bower_components/tinymce/tinymce.jquery'
            ]
        },
        "bower_components/redactorjs/redactor": {
            format: "global",
            exports: "$.fn.redactor",
            deps: [
                "jquery",
                "bower_components/redactorjs/plugins/fontfamily/fontfamily",
                "bower_components/redactorjs/plugins/fontsize/fontsize",
                "bower_components/redactorjs/plugins/video/video",
                "bower_components/redactorjs/plugins/textexpander/textexpander",
                "bower_components/redactorjs/plugins/table/table",
                "bower_components/redactorjs/plugins/limiter/limiter",
                "bower_components/redactorjs/plugins/fontcolor/fontcolor",
                "bower_components/redactorjs/plugins/filemanager/filemanager",
                "bower_components/redactorjs/plugins/definedlinks/definedlinks",
                "bower_components/redactorjs/plugins/counter/counter",
                "bower_components/redactorjs/redactor.css!",

            ]
        },
        "bower_components/redactorjs/plugins/fontfamily/fontfamily": {
            format: "global",
            exports: "window.RedactorPlugins.fontfamily"
        },
        "bower_components/redactorjs/plugins/fontsize/fontsize": {
            format: "global",
            exports: "window.RedactorPlugins.fontsize"
        },
        "bower_components/redactorjs/plugins/video/video": {
            format: "global",
            exports: "window.RedactorPlugins.video"
        },
        "bower_components/redactorjs/plugins/textexpander/textexpander": {
            format: "global",
            exports: "window.RedactorPlugins.textexpander"
        },
        "bower_components/redactorjs/plugins/table/table": {
            format: "global",
            exports: "window.RedactorPlugins.table"
        },
        "bower_components/redactorjs/plugins/limiter/limiter": {
            format: "global",
            exports: "window.RedactorPlugins.limiter"
        },
        "bower_components/redactorjs/plugins/fontcolor/fontcolor": {
            format: "global",
            exports: "window.RedactorPlugins.fontcolor"
        },
        "bower_components/redactorjs/plugins/filemanager/filemanager": {
            format: "global",
            exports: "window.RedactorPlugins.filemanager"
        },
        "bower_components/redactorjs/plugins/definedlinks/definedlinks": {
            format: "global",
            exports: "window.RedactorPlugins.definedlinks"
        },
        "bower_components/redactorjs/plugins/counter/counter": {
            format: "global",
            exports: "window.RedactorPlugins.counter"
        },
        "bower_components/redactorjs/lang/ru": {
            format: "global",

            exports: "jQuery",
            deps: ["jquery", "bower_components/redactorjs/redactor"]
        },

        'editor/helpers/jquery-ui-build/jquery-ui-build.concat': {
            format: "global",

            exports: "jQuery",
            deps: ["jquery"]
        },
        'bower_components/bootstrap3-dialog/dist/js/bootstrap-dialog.min': {
            format: "global",

            exports: "jQuery",
            deps: ["jquery", "bower_components/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css!"]
        },

        "bower_components/ace-builds/src-noconflict/ace": {
            format: "global",
            exports: "ace"
        },
        "bower_components/ace-builds/src-noconflict/ext-emmet": {
            format: "global",
            exports: "ace"
        },
        "bower_components/ace-builds/src-noconflict/ext-language_tools": {
            format: "global",
            exports: "ace"
        },
        "bower_components/ace-builds/src-noconflict/mode-html": {
            format: "global",
            exports: "ace"
        },
        "bower_components/ace-builds/src-noconflict/theme-ambiance": {
            format: "global",
            exports: "ace"
        },
        "editor/modules/code-editor/html-parser": {
            format: "global",
            exports: "HtmlParser",
            deps: ["bower_components/ace-builds/src-noconflict/ace","bower_components/ace-builds/src-noconflict/ext-emmet","bower_components/ace-builds/src-noconflict/ext-language_tools","bower_components/ace-builds/src-noconflict/mode-html","bower_components/ace-builds/src-noconflict/theme-ambiance"]
        }
    }
});

System.buildConfig = {
    map: {"can/util/util" : "can/util/domless/domless"}
};

test.js

define(['bootstrap.css!'], function(css){
    console.log(css);
    debugger
    /**
     * @class editor/modules/test
     * @alias Test
     */
    return can.Control(
        /** @Static */
        {
            defaults : {}
        },
        /** @Prototype */
        {
            init : function(){
                this.element.html(initView({
                    message: "Hello World from Test"
                }));
            }
        });
});

I wrote in node_modules https://github.com/bitovi/transpile/pull/13 and all was the work

matthewp commented 9 years ago

Ah, I see. Thanks!

matthewp commented 9 years ago

What is text.js, is this own custom css plugin?

matthewp commented 9 years ago

I couldn't recreate this error. I understand that adding the check for options fixed it in your case but I'm not sure why that check is needed, steal-tools should always be passing an options object to transpile. Can you give me a more complete (and smaller) example that shows the failure?

meded90 commented 9 years ago

I honestly do not understand why I had such a problem.

I just opened the files with errors and found node_modules/steal-tools/lib/graph/transpile.js:10

var winston = require('winston');
var transpile = require('transpile');

module.exports = function(graph, outputFormat){
    winston.info('\nTranspiling...');
    for(var name in graph) {
        var node = graph[name];
        if(!node.minifiedSource &&
            (!node.load.metadata.buildType || node.load.metadata.buildType === "js" )) {
            node.transpiledSource = transpile.to(node.load, outputFormat); // <- there are two parameters
        }
    }
};

node_modules/steal-tools/node_modules/transpile/main.js:56

// transpile.to
...
var transpile = {
    transpilers: transpilers,
    // transpile.to("amd",load)
    to: function(load, type, options){  // <-- there are three parameters
...

var copy = copyLoad(load);

for(var i =0; i < path.length - 1; i++) {
    var transpiler = transpilers[path[i]+"_"+path[i+1]] || toSelf;  
    copy.source = transpiler(copy, options); // <-- nonexistent parameter
}
return copy.source;

...

" What is text.js, is this own custom css plugin? " I needed a plugin that exalts css text for transmission to ifreme Tested without this plugin

matthewp commented 9 years ago

Ah, you're using an older version then. This is fixed in 0.5.0.