jwvdiermen / grunt-include-source

Include lists of files into your source files automatically.
MIT License
68 stars 31 forks source link

Warning: Symbol is not defined Use --force to continue. #46

Open mcknasty opened 8 years ago

mcknasty commented 8 years ago

Hi,

I'm getting the error about and it does seem very helpful. I even get it when I am running the unit test.

xxxxxxxxxxxx:grunt-include-source xxxxxxxxx$ grunt includeSource Initializing Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks. Initializing config...OK

Registering "tasks" tasks. Loading "includeSource.js" tasks...OK

Registering "grunt-contrib-jshint" local Npm module tasks. Reading /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-contrib-jshint/package.json...OK Parsing /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-contrib-jshint/package.json...OK Loading "jshint.js" tasks...OK

Registering "grunt-contrib-clean" local Npm module tasks. Reading /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-contrib-clean/package.json...OK Parsing /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-contrib-clean/package.json...OK Loading "clean.js" tasks...OK

Registering "grunt-contrib-nodeunit" local Npm module tasks. Reading /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-contrib-nodeunit/package.json...OK Parsing /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-contrib-nodeunit/package.json...OK Loading "nodeunit.js" tasks...OK

Registering "grunt-lineending" local Npm module tasks. Reading /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-lineending/package.json...OK Parsing /Users/tmckeown/Documents/Aptana Studio 3 Workspace/book_example/node_modules/grunt-include-source/node_modules/grunt-lineending/package.json...OK Loading "lineending.js" tasks...OK

Running tasks: includeSource

Running "includeSource" task

Running "includeSource:baseUrlHtmlTest" (includeSource) task Verifying property includeSource.baseUrlHtmlTest exists in config...OK Files: test/files/baseUrl.html -> tmp/baseUrl.html Options: basePath="test/files", baseUrl="test/files/", templates={}, typeMappings={}, rename=undefined Warning: Symbol is not defined Use --force to continue.

Aborted due to warnings.

jwvdiermen commented 8 years ago

Sorry, but I'm not able to reproduce this warning. I tried both Windows and Linux (Docker container running the image node:4.2) and ran grunt test, but no warnings about a symbol not being defined.

Any tips on how I can reproduce this? I don't own a mac.

ahhatem commented 8 years ago

Hi, I am facing the same issue, I am also on mac. The problem is in the "extendr" class. When I commented/disabled, things worked correctly. I managed to make it work by changing the file to the following:

           options.target = this.target;
            grunt.log.debug('Ahhatem: before adding the type mapping');

            //var typeMappings = extendr.clone(defaultTypeMappings);
            var typeMappings = defaultTypeMappings;

            grunt.log.debug('Ahhatem: after adding the type mapping');
            //extendr.extend(typeMappings, options.typeMappings);
            //extendr.extend(typeMappings, options.typeMappings);
            grunt.log.debug('Ahhatem: after extending the type mapping');

            grunt.log.debug('Base path is "' + options.basePath + '".');

            // Iterate over all specified file groups.
            this.files.forEach(function(file) {
                    grunt.log.debug('Handling output file "' + file.dest + "'...");

                    // Concatenate the source files.
                    var contents = '';
                    var contentSources = file.src.filter(function(filePath) {
                                    grunt.log.debug('Using input file "' + filePath + '".');
                                    // Remove nonexistent files.
                                    if (!grunt.file.exists(filePath)) {
                                            grunt.log.warn('Source file "' + filePath + '" not found.');
                                            return false;
                                    } else {
                                            return true;
                                    }
                            }).map( function(filePath) {
                                    // Read and return the file's source.
                                    return grunt.file.read(filePath);
                            });

                    // Don't bother detecting newline if we have no more than 1 file.
                    if (contentSources.length > 1) {
                            // Detect the newline to use for the content files.
                            // Use the first file to detect the newlines, no use to test all of them.
                            var contentNewline = /\r\n/g.test(contentSources[0]) ? '\r\n' : '\n';

                            // Join the content files as one to be processed.
                            contents = contentSources.join(contentNewline);
                    }
                    else {
                            // Still use join here, since 'contentSources' could have a length of 0?
                            contents = contentSources.join();
                    }

                    // Parse the contents, using a parser based on the target file.
                    var fileType = path.extname(file.dest).substr(1);
                    grunt.log.debug('File type is "' + fileType + '"');

                    // Try and map the file type, using it instead.
                    var mappedFileType = typeMappings[fileType];
                    if (mappedFileType) {
                            grunt.log.debug('File type "' + fileType + '" maps to "' + mappedFileType + '"');
                            fileType = mappedFileType;
                    }

                    var parserFn = parsers[fileType];
                    var findEndMarker = endMarkerParsers[fileType];

                    if (!parserFn) {
                            grunt.log.error('No parser found found file type "' + fileType + '".');
                            return false;
                    }

                    // Get the available templates.
                    var localTemplates = templates;
                    //extendr.safeDeepExtendPlainObjects(localTemplates, options.templates);
                    var typeTemplates = localTemplates[fileType];