@marko/compiler
Advanced tools
@@ -223,5 +223,4 @@ "use strict"; | ||
| // is a much simpler way for a developer to create custom tags. | ||
| // Only one tag is allowed per directory and the directory name | ||
| // corresponds to the tag name. We only search for directories | ||
| // one level deep. | ||
| // Each tag is a file or directory named after the tag; non-tag | ||
| // directories are scanned one level deep for nested tags. | ||
| var taglib = this.taglib; | ||
@@ -228,0 +227,0 @@ var path = this.filePath; |
@@ -36,2 +36,7 @@ "use strict"; | ||
| // Directories skipped when crawling groups for nested tags: dot-directories | ||
| // (e.g. `.git`) and discovery-root folders (`tags`/`components`), which stay | ||
| // private to their location (e.g. a nested `tags/tags`). | ||
| const ignoredDirName = /^(?:\.|components$|tags$)/; | ||
| function createDefaultTagDef() { | ||
@@ -110,2 +115,10 @@ return { | ||
| function isDirectory(path) { | ||
| try { | ||
| return taglibConfig.fs.statSync(path).isDirectory(); | ||
| } catch (_) { | ||
| return false; | ||
| } | ||
| } | ||
| /** | ||
@@ -125,5 +138,7 @@ * @param {String} tagsConfigPath path to tag definition file | ||
| let prefix; | ||
| let nested; | ||
| if (typeof dir === "object") { | ||
| prefix = dir.prefix; | ||
| nested = dir.nested; | ||
| dir = dir.path; | ||
@@ -187,6 +202,22 @@ } | ||
| ); | ||
| } else { | ||
| // Skip this directory... there doesn't appear to be anything in it | ||
| continue; | ||
| } | ||
| // Not a tag itself: crawl one level into grouping directories for | ||
| // nested tags. Dot-directories and `tags`/`components` folders are | ||
| // skipped so they stay private to their location. | ||
| if ( | ||
| !nested && | ||
| !ignoredDirName.test(childFilename) && | ||
| isDirectory(tagDirname)) | ||
| { | ||
| scanTagsDir( | ||
| tagsConfigPath, | ||
| tagsConfigDirname, | ||
| { path: tagDirname, prefix, nested: true }, | ||
| taglib, | ||
| dependencyChain.append(childFilename) | ||
| ); | ||
| } | ||
| continue; | ||
| } | ||
@@ -193,0 +224,0 @@ } |
+1
-1
| { | ||
| "name": "@marko/compiler", | ||
| "version": "5.39.66", | ||
| "version": "5.40.0", | ||
| "description": "Marko template to JS compiler.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
5099829
0.02%124322
0.02%