(dependency, media) => { if (gutil.isUrl(dependency)) { // Relative file path from cwd const rpath = JSON.stringify(gutil.path2cwd(path)); // Output warn gutil.logger.warn( gutil.chalk.yellow(`Found remote css file ${JSON.stringify(dependency)} at ${rpath}, unsupported.`), '\x07' ); } else { if (media.length) { // Get media media = JSON.stringify(media.join(', ')); // Relative file path from cwd const rpath = JSON.stringify(gutil.path2cwd(path)); // Output warn gutil.logger.warn( gutil.chalk.yellow(`Found import media queries ${media} at ${rpath}, unsupported.`), '\x07' ); } // Normalize dependency = gutil.normalize(dependency); // Resolve dependency const resolved = resolve(dependency, path, { root }); // Module can read if (gutil.fsSafeAccess(resolved)) { dependencies.add(resolved); } else { // Relative file path from cwd const rpath = JSON.stringify(gutil.path2cwd(path)); // Output warn gutil.logger.warn( gutil.chalk.yellow(`Module ${JSON.stringify(dependency)} at ${rpath} can't be found.`), '\x07' ); } // Parse map dependency = gutil.parseMap(dependency, resolved, options.map); dependency = gutil.normalize(dependency); } return combine(path) ? false : dependency; },
(dependency, flag) => { dependency = parseAlias(dependency, options.alias); // Only collect local bependency if (!gutil.isUrl(dependency)) { // Normalize dependency = gutil.normalize(dependency); // If path end with /, use index.js if (dependency.endsWith('/')) dependency += 'index.js'; // Resolve dependency let resolved = resolve(dependency, path, { root, base }); // Only collect require no flag if (flag === null) { // If has ext and module can read if (fileExt(resolved) && gutil.fsSafeAccess(resolved)) { !isIgnoreModule(resolved, options) && modules.add(resolved); } else { // Module can't read, add ext test again resolved = addExt(resolved); // Module can read if (gutil.fsSafeAccess(resolved)) { !isIgnoreModule(resolved, options) && modules.add(resolved); } else { // Relative path from cwd const rpath = JSON.stringify(gutil.path2cwd(path)); // Output warn gutil.logger.warn( gutil.chalk.yellow(`Module ${JSON.stringify(dependency)} at ${rpath} can't be found.`), '\x07' ); } } } // Parse map dependency = gutil.parseMap(dependency, resolved, options.map); dependency = gutil.normalize(dependency); dependency = hideExt(dependency); // The seajs has hacked css before 3.0.0 // https://github.com/seajs/seajs/blob/2.2.1/src/util-path.js#L49 // Demo https://github.com/popomore/seajs-test/tree/master/css-deps if (fileExt(dependency) === '.css') dependency = addExt(dependency); // Add dependency dependencies.add(dependency); } // Return dependency return dependency; },
(dependency, media) => { if (gutil.isUrl(dependency)) { // Relative file path from cwd const rpath = JSON.stringify(gutil.path2cwd(path)); // Output warn gutil.logger.warn( gutil.chalk.yellow(`Found remote css file ${JSON.stringify(dependency)} at ${rpath}, unsupported.`), '\x07' ); } else { if (media.length) { // Get media media = JSON.stringify(media.join(', ')); // Relative file path from cwd const rpath = JSON.stringify(gutil.path2cwd(path)); // Output warn gutil.logger.warn( gutil.chalk.yellow(`Found import media queries ${media} at ${rpath}, unsupported.`), '\x07' ); } // Normalize dependency = gutil.normalize(dependency); // Resolve dependency let resolved = resolve(dependency, path, { root }); // Module can read if (gutil.fsSafeAccess(resolved)) { !isIgnoreModule(resolved, options) && modules.add(resolved); } else { // Relative file path from cwd const rpath = JSON.stringify(gutil.path2cwd(path)); // Output warn gutil.logger.warn( gutil.chalk.yellow(`Module ${JSON.stringify(dependency)} at ${rpath} can't be found.`), '\x07' ); } // Use css resolve rule if (!gutil.isRelative(dependency)) dependency = `./${dependency}`; // Parse map dependency = gutil.parseMap(dependency, resolved, options.map); dependency = gutil.normalize(dependency); // The seajs has hacked css before 3.0.0 // https://github.com/seajs/seajs/blob/2.2.1/src/util-path.js#L49 // Demo https://github.com/popomore/seajs-test/tree/master/css-deps dependency = addExt(dependency); // Add dependency dependencies.add(dependency); } return false; },