@@ -81,7 +81,7 @@ fast_push default_plugins,
8181 name: "lua"
8282 searchpath: (packer, name) -> searchpath_compat name, package.path
8383
84- if yue
84+ if "table" == type yue
8585 fast_push default_plugins,
8686 name: "yuescript"
8787 searchpath: (packer, name) -> searchpath_compat name, package_path_with_different_extension "yue"
9090 lua = yue.to_lua content, reserve_line_number: false
9191 lua, replace_file_extension filename, ".yue", ".lua"
9292
93- if moon
93+ if "table" == type moon
9494 fast_push default_plugins,
9595 name: "moonscript"
9696 searchpath: (packer, name) -> searchpath_compat name, package_path_with_different_extension "moon"
@@ -151,7 +151,7 @@ export class Packer
151151 error "file not found: #{entry}" unless @loaded["__luapack_entry__"]?
152152
153153 packed = @bootstrap!
154- packed = minifier.Rebuild.MinifyString packed if @options.minify != false and minifier
154+ packed = minifier.Rebuild.MinifyString packed if @options.minify != false and "table" == type minifier
155155 header = ""
156156 if @options.with_header != false
157157 header = "-- luapacked using #{__version__}\n"
@@ -205,12 +205,7 @@ export class Packer
205205 writer\str!
206206
207207-- cli
208- arguments = {...}
209- arguments.n = #arguments
210-
211- -- "clever" cli detection
212- if arguments.n > 0 and arguments[2] != ":preload:" and not package.loaded[arguments[1]]?
213- -- user is using cli!
208+ cli = (arguments) ->
214209 options = {}
215210 for arg in *arguments
216211 continue if "-" != arg\sub 1, 1
@@ -235,3 +230,21 @@ if arguments.n > 0 and arguments[2] != ":preload:" and not package.loaded[argume
235230 with io.open outfile, "w"
236231 \write packed
237232 \close!
233+
234+
235+ check_cli = =>
236+ return if @n == 0
237+ return if @[2] == ":preload:" -- package.preload (luapacked)
238+ return unless arg? -- support for cli args
239+
240+ -- check if they match
241+ for i = 1, @n
242+ return if arg[i] != @[i] -- dont match
243+
244+ true
245+
246+
247+ arguments = {...}
248+ arguments.n = #arguments
249+
250+ cli arguments if check_cli arguments
0 commit comments