From 2d27820945b9154f80aeac8472fb99e5950c610b Mon Sep 17 00:00:00 2001 From: George Lemon Date: Thu, 10 Oct 2024 15:45:14 +0300 Subject: [PATCH] Comment wip package manager Signed-off-by: George Lemon --- src/timpkg/engine/meta.nim | 8 +++--- src/timpkg/engine/parser.nim | 49 ++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/timpkg/engine/meta.nim b/src/timpkg/engine/meta.nim index 3cb72da..839aa7a 100755 --- a/src/timpkg/engine/meta.nim +++ b/src/timpkg/engine/meta.nim @@ -13,7 +13,7 @@ import pkg/importer/resolver export getProjectPath from ./ast import Ast -from ./package/manager import Packager, loadPackages +# from ./package/manager import Packager, loadPackages var placeholderLocker*: Lock @@ -58,7 +58,7 @@ type policy: TimPolicy globals: JsonNode = newJObject() importsHandle*: Resolver - packager*: Packager + # packager*: Packager TimEngineSnippets* = TableRef[string, seq[Ast]] TimError* = object of CatchableError @@ -375,9 +375,9 @@ proc newTim*(src, output, basepath: string, minify = true, minify: minify, indentSize: indent, htmlErrors: showHtmlError, - packager: Packager() + # packager: Packager() ) - result.packager.loadPackages() + # result.packager.loadPackages() for sourceDir in [ttLayout, ttView, ttPartial]: if not dirExists(result.src / $sourceDir): raise newException(TimError, "Missing $1 directory: \n$2" % [$sourceDir, result.src / $sourceDir]) diff --git a/src/timpkg/engine/parser.nim b/src/timpkg/engine/parser.nim index d292700..b3eafc2 100755 --- a/src/timpkg/engine/parser.nim +++ b/src/timpkg/engine/parser.nim @@ -8,8 +8,8 @@ import std/[macros, macrocache, streams, lexbase, strutils, sequtils, re, tables, os, with, options] -import ./meta, ./tokens, ./ast, ./logging, - ./std, ./package/manager +import ./meta, ./tokens, ./ast, ./logging, ./std +# import ./package/manager import pkg/kapsis/cli import pkg/importer @@ -1117,20 +1117,21 @@ prefixHandle pImport: p.engine.parseModule(p.curr.value, std(p.curr.value)[1]) p.tree.modules[p.curr.value].src = p.curr.value elif p.curr.value.startsWith("pkg/"): - if likely(p.engine.packager.hasPackage(p.curr.value[4..^1].split("/")[0])): - # var moduleAst: Ast - # if likely(p.engine.packager.flagNoCache == false): - # moduleAst = p.engine.packager.getCachedModule(p.curr.value) - # if moduleAst != nil: - # p.tree.modules[p.curr.value] = moduleAst - # else: - let moduleCode = p.engine.packager.loadModule(p.curr.value) - let moduleAst = p.engine.parseModule(p.curr.value, SourceCode(moduleCode)) - p.tree.modules[p.curr.value] = moduleAst - # if p.engine.packager.flagNoCache == false: - # p.engine.packager.cacheModule(p.curr.value, moduleAst) - else: - errorWithArgs(importError, p.curr, [p.curr.value.addFileExt(".timl")]) + discard # todo + # if likely(p.engine.packager.hasPackage(p.curr.value[4..^1].split("/")[0])): + # # var moduleAst: Ast + # # if likely(p.engine.packager.flagNoCache == false): + # # moduleAst = p.engine.packager.getCachedModule(p.curr.value) + # # if moduleAst != nil: + # # p.tree.modules[p.curr.value] = moduleAst + # # else: + # let moduleCode = p.engine.packager.loadModule(p.curr.value) + # let moduleAst = p.engine.parseModule(p.curr.value, SourceCode(moduleCode)) + # p.tree.modules[p.curr.value] = moduleAst + # # if p.engine.packager.flagNoCache == false: + # # p.engine.packager.cacheModule(p.curr.value, moduleAst) + # else: + # errorWithArgs(importError, p.curr, [p.curr.value.addFileExt(".timl")]) else: let path = (if not isAbsolute(p.curr.value): @@ -1896,13 +1897,13 @@ proc parseSnippet*(id, code: string, logger: Logger(filePath: id), engine: TimEngine( `type`: TimEngineRuntime.runtimePassAndExit, - packager: Packager( - flagNoCache: noCache, - flagRecache: reCache - ) + # packager: Packager( + # flagNoCache: noCache, + # flagRecache: reCache + # ) ), ) - p.engine.packager.loadPackages() + # p.engine.packager.loadPackages() p.curr = p.lex.getToken() p.next = p.lex.getToken() initModuleSystem() @@ -1931,9 +1932,9 @@ proc parseSnippet*(snippetPath: string): Parser {.gcsafe.} = logger: Logger(filePath: snippetPath), engine: TimEngine( `type`: TimEngineRuntime.runtimePassAndExit, - packager: Packager( - flagNoCache: true - ) + # packager: Packager( + # flagNoCache: true + # ) ), ) p.curr = p.lex.getToken()