@@ -79,18 +79,18 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
7979 name = NormalizeFileName(filename)
8080 slug = SLUGGER_RE.sub('_', name)
8181 var = slug + '_raw'
82- @@ -123,7 +127 ,9 @@ def AddModule(filename, definitions, initializers):
82+ @@ -123,7 +123 ,9 @@ def AddModule(filename, definitions, initializers):
8383 initializers.append(initializer)
8484
8585 def NormalizeFileName(filename):
86- - split = filename.split(os.path.sep )
86+ - split = filename.split('/' )
8787+ if filename.startswith('//v8'):
8888+ filename = "deps/" + filename[2:]
89- + split = os.path.normpath(filename).split(os.path.sep )
89+ + split = os.path.normpath(filename).split('/' )
9090 if split[0] == 'deps':
9191 split = ['internal'] + split
9292 else: # `lib/**/*.js` so drop the 'lib' part
93- @@ -141,7 +147 ,7 @@ def NormalizeFileName(filename):
93+ @@ -141,7 +143 ,7 @@ def NormalizeFileName(filename):
9494 return os.path.splitext(filename)[0]
9595
9696
@@ -99,8 +99,8 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
9999 # Build source code lines
100100 definitions = []
101101 initializers = []
102- @@ -149 ,13 +155 ,26 @@ def JS2C(source_files, target):
103- for filename in source_files['.js ']:
102+ @@ -151 ,13 +153 ,26 @@ def JS2C(source_files, target):
103+ for filename in source_files['.mjs ']:
104104 AddModule(filename, definitions, initializers)
105105
106106- config_def, config_size = handle_config_gypi(source_files['config.gypi'])
@@ -129,7 +129,7 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
129129 write_if_chaged(out, target)
130130
131131
132- @@ -211,17 +230,21 @@ def main():
132+ @@ -213,18 +228,22 @@ def main():
133133 )
134134 parser.add_argument('--target', help='output file')
135135 parser.add_argument('--verbose', action='store_true', help='output file')
@@ -139,20 +139,24 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
139139 global is_verbose
140140 is_verbose = options.verbose
141141 source_files = functools.reduce(SourceFileByExt, options.sources, {})
142- # Should have exactly 2 types: `.js`, and `.gypi`
143- - assert len(source_files) == 2
142+ - # Should have exactly 3 types: `.js`, `.mjs` and `.gypi`
143+ - assert len(source_files) == 3
144144- # Currently config.gypi is the only `.gypi` file allowed
145145- assert source_files['.gypi'] == ['config.gypi']
146146- source_files['config.gypi'] = source_files.pop('.gypi')[0]
147147- JS2C(source_files, options.target)
148+ -
148149+ if options.only_js:
149- + assert len(source_files) == 1
150- + else:
150+ + # Should have exactly 3 types: `.js`, `.mjs`
151151+ assert len(source_files) == 2
152+ + else:
153+ + # Should have exactly 3 types: `.js`, `.mjs` and `.gypi`
154+ + assert len(source_files) == 3
152155+ # Currently config.gypi is the only `.gypi` file allowed
153156+ assert source_files['.gypi'][0].endswith('config.gypi')
154157+ source_files['config.gypi'] = source_files.pop('.gypi')[0]
155158+ JS2C(source_files, options.target, options.only_js)
156159
157-
158160 if __name__ == "__main__":
161+ main()
162+
0 commit comments